3 #ifndef PY_SSIZE_T_CLEAN
4 #define PY_SSIZE_T_CLEAN
8 #error Python headers needed to compile C extensions, please install development version of Python.
9 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
10 #error Cython requires Python 2.6+ or Python 3.3+.
12 #define CYTHON_ABI "0_29_24"
13 #define CYTHON_HEX_VERSION 0x001D18F0
14 #define CYTHON_FUTURE_DIVISION 0
17 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
19 #if !defined(WIN32) && !defined(MS_WINDOWS)
31 #define DL_IMPORT(t) t
34 #define DL_EXPORT(t) t
37 #ifndef HAVE_LONG_LONG
38 #if PY_VERSION_HEX >= 0x02070000
39 #define HAVE_LONG_LONG
43 #define PY_LONG_LONG LONG_LONG
46 #define Py_HUGE_VAL HUGE_VAL
49 #define CYTHON_COMPILING_IN_PYPY 1
50 #define CYTHON_COMPILING_IN_PYSTON 0
51 #define CYTHON_COMPILING_IN_CPYTHON 0
52 #undef CYTHON_USE_TYPE_SLOTS
53 #define CYTHON_USE_TYPE_SLOTS 0
54 #undef CYTHON_USE_PYTYPE_LOOKUP
55 #define CYTHON_USE_PYTYPE_LOOKUP 0
56 #if PY_VERSION_HEX < 0x03050000
57 #undef CYTHON_USE_ASYNC_SLOTS
58 #define CYTHON_USE_ASYNC_SLOTS 0
59 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
60 #define CYTHON_USE_ASYNC_SLOTS 1
62 #undef CYTHON_USE_PYLIST_INTERNALS
63 #define CYTHON_USE_PYLIST_INTERNALS 0
64 #undef CYTHON_USE_UNICODE_INTERNALS
65 #define CYTHON_USE_UNICODE_INTERNALS 0
66 #undef CYTHON_USE_UNICODE_WRITER
67 #define CYTHON_USE_UNICODE_WRITER 0
68 #undef CYTHON_USE_PYLONG_INTERNALS
69 #define CYTHON_USE_PYLONG_INTERNALS 0
70 #undef CYTHON_AVOID_BORROWED_REFS
71 #define CYTHON_AVOID_BORROWED_REFS 1
72 #undef CYTHON_ASSUME_SAFE_MACROS
73 #define CYTHON_ASSUME_SAFE_MACROS 0
74 #undef CYTHON_UNPACK_METHODS
75 #define CYTHON_UNPACK_METHODS 0
76 #undef CYTHON_FAST_THREAD_STATE
77 #define CYTHON_FAST_THREAD_STATE 0
78 #undef CYTHON_FAST_PYCALL
79 #define CYTHON_FAST_PYCALL 0
80 #undef CYTHON_PEP489_MULTI_PHASE_INIT
81 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
82 #undef CYTHON_USE_TP_FINALIZE
83 #define CYTHON_USE_TP_FINALIZE 0
84 #undef CYTHON_USE_DICT_VERSIONS
85 #define CYTHON_USE_DICT_VERSIONS 0
86 #undef CYTHON_USE_EXC_INFO_STACK
87 #define CYTHON_USE_EXC_INFO_STACK 0
88 #elif defined(PYSTON_VERSION)
89 #define CYTHON_COMPILING_IN_PYPY 0
90 #define CYTHON_COMPILING_IN_PYSTON 1
91 #define CYTHON_COMPILING_IN_CPYTHON 0
92 #ifndef CYTHON_USE_TYPE_SLOTS
93 #define CYTHON_USE_TYPE_SLOTS 1
95 #undef CYTHON_USE_PYTYPE_LOOKUP
96 #define CYTHON_USE_PYTYPE_LOOKUP 0
97 #undef CYTHON_USE_ASYNC_SLOTS
98 #define CYTHON_USE_ASYNC_SLOTS 0
99 #undef CYTHON_USE_PYLIST_INTERNALS
100 #define CYTHON_USE_PYLIST_INTERNALS 0
101 #ifndef CYTHON_USE_UNICODE_INTERNALS
102 #define CYTHON_USE_UNICODE_INTERNALS 1
104 #undef CYTHON_USE_UNICODE_WRITER
105 #define CYTHON_USE_UNICODE_WRITER 0
106 #undef CYTHON_USE_PYLONG_INTERNALS
107 #define CYTHON_USE_PYLONG_INTERNALS 0
108 #ifndef CYTHON_AVOID_BORROWED_REFS
109 #define CYTHON_AVOID_BORROWED_REFS 0
111 #ifndef CYTHON_ASSUME_SAFE_MACROS
112 #define CYTHON_ASSUME_SAFE_MACROS 1
114 #ifndef CYTHON_UNPACK_METHODS
115 #define CYTHON_UNPACK_METHODS 1
117 #undef CYTHON_FAST_THREAD_STATE
118 #define CYTHON_FAST_THREAD_STATE 0
119 #undef CYTHON_FAST_PYCALL
120 #define CYTHON_FAST_PYCALL 0
121 #undef CYTHON_PEP489_MULTI_PHASE_INIT
122 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
123 #undef CYTHON_USE_TP_FINALIZE
124 #define CYTHON_USE_TP_FINALIZE 0
125 #undef CYTHON_USE_DICT_VERSIONS
126 #define CYTHON_USE_DICT_VERSIONS 0
127 #undef CYTHON_USE_EXC_INFO_STACK
128 #define CYTHON_USE_EXC_INFO_STACK 0
130 #define CYTHON_COMPILING_IN_PYPY 0
131 #define CYTHON_COMPILING_IN_PYSTON 0
132 #define CYTHON_COMPILING_IN_CPYTHON 1
133 #ifndef CYTHON_USE_TYPE_SLOTS
134 #define CYTHON_USE_TYPE_SLOTS 1
136 #if PY_VERSION_HEX < 0x02070000
137 #undef CYTHON_USE_PYTYPE_LOOKUP
138 #define CYTHON_USE_PYTYPE_LOOKUP 0
139 #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
140 #define CYTHON_USE_PYTYPE_LOOKUP 1
142 #if PY_MAJOR_VERSION < 3
143 #undef CYTHON_USE_ASYNC_SLOTS
144 #define CYTHON_USE_ASYNC_SLOTS 0
145 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
146 #define CYTHON_USE_ASYNC_SLOTS 1
148 #if PY_VERSION_HEX < 0x02070000
149 #undef CYTHON_USE_PYLONG_INTERNALS
150 #define CYTHON_USE_PYLONG_INTERNALS 0
151 #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
152 #define CYTHON_USE_PYLONG_INTERNALS 1
154 #ifndef CYTHON_USE_PYLIST_INTERNALS
155 #define CYTHON_USE_PYLIST_INTERNALS 1
157 #ifndef CYTHON_USE_UNICODE_INTERNALS
158 #define CYTHON_USE_UNICODE_INTERNALS 1
160 #if PY_VERSION_HEX < 0x030300F0
161 #undef CYTHON_USE_UNICODE_WRITER
162 #define CYTHON_USE_UNICODE_WRITER 0
163 #elif !defined(CYTHON_USE_UNICODE_WRITER)
164 #define CYTHON_USE_UNICODE_WRITER 1
166 #ifndef CYTHON_AVOID_BORROWED_REFS
167 #define CYTHON_AVOID_BORROWED_REFS 0
169 #ifndef CYTHON_ASSUME_SAFE_MACROS
170 #define CYTHON_ASSUME_SAFE_MACROS 1
172 #ifndef CYTHON_UNPACK_METHODS
173 #define CYTHON_UNPACK_METHODS 1
175 #ifndef CYTHON_FAST_THREAD_STATE
176 #define CYTHON_FAST_THREAD_STATE 1
178 #ifndef CYTHON_FAST_PYCALL
179 #define CYTHON_FAST_PYCALL 1
181 #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
182 #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
184 #ifndef CYTHON_USE_TP_FINALIZE
185 #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
187 #ifndef CYTHON_USE_DICT_VERSIONS
188 #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
190 #ifndef CYTHON_USE_EXC_INFO_STACK
191 #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
194 #if !defined(CYTHON_FAST_PYCCALL)
195 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
197 #if CYTHON_USE_PYLONG_INTERNALS
198 #include "longintrepr.h"
203 enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P ==
sizeof(
void*)) };
206 #ifndef __has_attribute
207 #define __has_attribute(x) 0
209 #ifndef __has_cpp_attribute
210 #define __has_cpp_attribute(x) 0
212 #ifndef CYTHON_RESTRICT
213 #if defined(__GNUC__)
214 #define CYTHON_RESTRICT __restrict__
215 #elif defined(_MSC_VER) && _MSC_VER >= 1400
216 #define CYTHON_RESTRICT __restrict
217 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
218 #define CYTHON_RESTRICT restrict
220 #define CYTHON_RESTRICT
223 #ifndef CYTHON_UNUSED
224 # if defined(__GNUC__)
225 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
226 # define CYTHON_UNUSED __attribute__ ((__unused__))
228 # define CYTHON_UNUSED
230 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
231 # define CYTHON_UNUSED __attribute__ ((__unused__))
233 # define CYTHON_UNUSED
236 #ifndef CYTHON_MAYBE_UNUSED_VAR
237 # if defined(__cplusplus)
238 template<
class T>
void CYTHON_MAYBE_UNUSED_VAR(
const T& ) { }
240 # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
243 #ifndef CYTHON_NCP_UNUSED
244 # if CYTHON_COMPILING_IN_CPYTHON
245 # define CYTHON_NCP_UNUSED
247 # define CYTHON_NCP_UNUSED CYTHON_UNUSED
250 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
252 #ifndef _MSC_STDINT_H_
254 typedef unsigned char uint8_t;
255 typedef unsigned int uint32_t;
257 typedef unsigned __int8 uint8_t;
258 typedef unsigned __int32 uint32_t;
264 #ifndef CYTHON_FALLTHROUGH
265 #if defined(__cplusplus) && __cplusplus >= 201103L
266 #if __has_cpp_attribute(fallthrough)
267 #define CYTHON_FALLTHROUGH [[fallthrough]]
268 #elif __has_cpp_attribute(clang::fallthrough)
269 #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
270 #elif __has_cpp_attribute(gnu::fallthrough)
271 #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
274 #ifndef CYTHON_FALLTHROUGH
275 #if __has_attribute(fallthrough)
276 #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
278 #define CYTHON_FALLTHROUGH
281 #if defined(__clang__ ) && defined(__apple_build_version__)
282 #if __apple_build_version__ < 7000000
283 #undef CYTHON_FALLTHROUGH
284 #define CYTHON_FALLTHROUGH
289 #ifndef CYTHON_INLINE
290 #if defined(__clang__)
291 #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
292 #elif defined(__GNUC__)
293 #define CYTHON_INLINE __inline__
294 #elif defined(_MSC_VER)
295 #define CYTHON_INLINE __inline
296 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
297 #define CYTHON_INLINE inline
299 #define CYTHON_INLINE
303 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
304 #define Py_OptimizeFlag 0
306 #define __PYX_BUILD_PY_SSIZE_T "n"
307 #define CYTHON_FORMAT_SSIZE_T "z"
308 #if PY_MAJOR_VERSION < 3
309 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
310 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
311 PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
312 #define __Pyx_DefaultClassType PyClass_Type
314 #define __Pyx_BUILTIN_MODULE_NAME "builtins"
315 #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
316 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
317 PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
319 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
320 PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
322 #define __Pyx_DefaultClassType PyType_Type
324 #ifndef Py_TPFLAGS_CHECKTYPES
325 #define Py_TPFLAGS_CHECKTYPES 0
327 #ifndef Py_TPFLAGS_HAVE_INDEX
328 #define Py_TPFLAGS_HAVE_INDEX 0
330 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
331 #define Py_TPFLAGS_HAVE_NEWBUFFER 0
333 #ifndef Py_TPFLAGS_HAVE_FINALIZE
334 #define Py_TPFLAGS_HAVE_FINALIZE 0
336 #ifndef METH_STACKLESS
337 #define METH_STACKLESS 0
339 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
340 #ifndef METH_FASTCALL
341 #define METH_FASTCALL 0x80
343 typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *
self, PyObject *
const *args, Py_ssize_t nargs);
344 typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *
self, PyObject *
const *args,
345 Py_ssize_t nargs, PyObject *kwnames);
347 #define __Pyx_PyCFunctionFast _PyCFunctionFast
348 #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
350 #if CYTHON_FAST_PYCCALL
351 #define __Pyx_PyFastCFunction_Check(func)\
352 ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
354 #define __Pyx_PyFastCFunction_Check(func) 0
356 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
357 #define PyObject_Malloc(s) PyMem_Malloc(s)
358 #define PyObject_Free(p) PyMem_Free(p)
359 #define PyObject_Realloc(p) PyMem_Realloc(p)
361 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
362 #define PyMem_RawMalloc(n) PyMem_Malloc(n)
363 #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n)
364 #define PyMem_RawFree(p) PyMem_Free(p)
366 #if CYTHON_COMPILING_IN_PYSTON
367 #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
368 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
370 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
371 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
373 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
374 #define __Pyx_PyThreadState_Current PyThreadState_GET()
375 #elif PY_VERSION_HEX >= 0x03060000
376 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
377 #elif PY_VERSION_HEX >= 0x03000000
378 #define __Pyx_PyThreadState_Current PyThreadState_GET()
380 #define __Pyx_PyThreadState_Current _PyThreadState_Current
382 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
383 #include "pythread.h"
384 #define Py_tss_NEEDS_INIT 0
385 typedef int Py_tss_t;
386 static CYTHON_INLINE
int PyThread_tss_create(Py_tss_t *key) {
387 *key = PyThread_create_key();
390 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(
void) {
391 Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(
sizeof(Py_tss_t));
392 *key = Py_tss_NEEDS_INIT;
395 static CYTHON_INLINE
void PyThread_tss_free(Py_tss_t *key) {
398 static CYTHON_INLINE
int PyThread_tss_is_created(Py_tss_t *key) {
399 return *key != Py_tss_NEEDS_INIT;
401 static CYTHON_INLINE
void PyThread_tss_delete(Py_tss_t *key) {
402 PyThread_delete_key(*key);
403 *key = Py_tss_NEEDS_INIT;
405 static CYTHON_INLINE
int PyThread_tss_set(Py_tss_t *key,
void *value) {
406 return PyThread_set_key_value(*key, value);
408 static CYTHON_INLINE
void * PyThread_tss_get(Py_tss_t *key) {
409 return PyThread_get_key_value(*key);
412 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
413 #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
415 #define __Pyx_PyDict_NewPresized(n) PyDict_New()
417 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
418 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
419 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
421 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
422 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
424 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
425 #define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
427 #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
429 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
430 #define CYTHON_PEP393_ENABLED 1
431 #if defined(PyUnicode_IS_READY)
432 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
433 0 : _PyUnicode_Ready((PyObject *)(op)))
435 #define __Pyx_PyUnicode_READY(op) (0)
437 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
438 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
439 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
440 #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
441 #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
442 #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
443 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
444 #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
445 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
446 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
448 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
451 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u))
454 #define CYTHON_PEP393_ENABLED 0
455 #define PyUnicode_1BYTE_KIND 1
456 #define PyUnicode_2BYTE_KIND 2
457 #define PyUnicode_4BYTE_KIND 4
458 #define __Pyx_PyUnicode_READY(op) (0)
459 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
460 #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
461 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
462 #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
463 #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
464 #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
465 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
466 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
468 #if CYTHON_COMPILING_IN_PYPY
469 #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
470 #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
472 #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
473 #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
474 PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
476 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
477 #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
479 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
480 #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
482 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
483 #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
485 #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
486 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
487 #if PY_MAJOR_VERSION >= 3
488 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
490 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
492 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
493 #define PyObject_ASCII(o) PyObject_Repr(o)
495 #if PY_MAJOR_VERSION >= 3
496 #define PyBaseString_Type PyUnicode_Type
497 #define PyStringObject PyUnicodeObject
498 #define PyString_Type PyUnicode_Type
499 #define PyString_Check PyUnicode_Check
500 #define PyString_CheckExact PyUnicode_CheckExact
501 #ifndef PyObject_Unicode
502 #define PyObject_Unicode PyObject_Str
505 #if PY_MAJOR_VERSION >= 3
506 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
507 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
509 #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
510 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
512 #ifndef PySet_CheckExact
513 #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
515 #if PY_VERSION_HEX >= 0x030900A4
516 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
517 #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
519 #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
520 #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
522 #if CYTHON_ASSUME_SAFE_MACROS
523 #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
525 #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
527 #if PY_MAJOR_VERSION >= 3
528 #define PyIntObject PyLongObject
529 #define PyInt_Type PyLong_Type
530 #define PyInt_Check(op) PyLong_Check(op)
531 #define PyInt_CheckExact(op) PyLong_CheckExact(op)
532 #define PyInt_FromString PyLong_FromString
533 #define PyInt_FromUnicode PyLong_FromUnicode
534 #define PyInt_FromLong PyLong_FromLong
535 #define PyInt_FromSize_t PyLong_FromSize_t
536 #define PyInt_FromSsize_t PyLong_FromSsize_t
537 #define PyInt_AsLong PyLong_AsLong
538 #define PyInt_AS_LONG PyLong_AS_LONG
539 #define PyInt_AsSsize_t PyLong_AsSsize_t
540 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
541 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
542 #define PyNumber_Int PyNumber_Long
544 #if PY_MAJOR_VERSION >= 3
545 #define PyBoolObject PyLongObject
547 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
548 #ifndef PyUnicode_InternFromString
549 #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
552 #if PY_VERSION_HEX < 0x030200A4
553 typedef long Py_hash_t;
554 #define __Pyx_PyInt_FromHash_t PyInt_FromLong
555 #define __Pyx_PyInt_AsHash_t PyInt_AsLong
557 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
558 #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
560 #if PY_MAJOR_VERSION >= 3
561 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
563 #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
565 #if CYTHON_USE_ASYNC_SLOTS
566 #if PY_VERSION_HEX >= 0x030500B1
567 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
568 #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
570 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
573 #define __Pyx_PyType_AsAsync(obj) NULL
575 #ifndef __Pyx_PyAsyncMethodsStruct
580 } __Pyx_PyAsyncMethodsStruct;
583 #if defined(WIN32) || defined(MS_WINDOWS)
584 #define _USE_MATH_DEFINES
588 #define __PYX_NAN() ((float) NAN)
590 static CYTHON_INLINE
float __PYX_NAN() {
592 memset(&value, 0xFF,
sizeof(value));
596 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
597 #define __Pyx_truncl trunc
599 #define __Pyx_truncl truncl
602 #define __PYX_MARK_ERR_POS(f_index, lineno) \
603 { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
604 #define __PYX_ERR(f_index, lineno, Ln_error) \
605 { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
607 #ifndef __PYX_EXTERN_C
609 #define __PYX_EXTERN_C extern "C"
611 #define __PYX_EXTERN_C extern
615 #define __PYX_HAVE__superluWrappers
616 #define __PYX_HAVE_API__superluWrappers
620 #include "numpy/arrayobject.h"
621 #include "numpy/ndarrayobject.h"
622 #include "numpy/ndarraytypes.h"
623 #include "numpy/arrayscalars.h"
624 #include "numpy/ufuncobject.h"
630 #include "pythread.h"
636 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
637 #define CYTHON_WITHOUT_ASSERTIONS
640 typedef struct {PyObject **p;
const char *
s;
const Py_ssize_t
n;
const char* encoding;
641 const char is_unicode;
const char is_str;
const char intern; } __Pyx_StringTabEntry;
643 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
644 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
645 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
646 #define __PYX_DEFAULT_STRING_ENCODING ""
647 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
648 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
649 #define __Pyx_uchar_cast(c) ((unsigned char)c)
650 #define __Pyx_long_cast(x) ((long)x)
651 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
652 (sizeof(type) < sizeof(Py_ssize_t)) ||\
653 (sizeof(type) > sizeof(Py_ssize_t) &&\
654 likely(v < (type)PY_SSIZE_T_MAX ||\
655 v == (type)PY_SSIZE_T_MAX) &&\
656 (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
657 v == (type)PY_SSIZE_T_MIN))) ||\
658 (sizeof(type) == sizeof(Py_ssize_t) &&\
659 (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
660 v == (type)PY_SSIZE_T_MAX))) )
661 static CYTHON_INLINE
int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
662 return (
size_t) i < (size_t) limit;
664 #if defined (__cplusplus) && __cplusplus >= 201103L
666 #define __Pyx_sst_abs(value) std::abs(value)
667 #elif SIZEOF_INT >= SIZEOF_SIZE_T
668 #define __Pyx_sst_abs(value) abs(value)
669 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
670 #define __Pyx_sst_abs(value) labs(value)
671 #elif defined (_MSC_VER)
672 #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
673 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
674 #define __Pyx_sst_abs(value) llabs(value)
675 #elif defined (__GNUC__)
676 #define __Pyx_sst_abs(value) __builtin_llabs(value)
678 #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
680 static CYTHON_INLINE
const char* __Pyx_PyObject_AsString(PyObject*);
681 static CYTHON_INLINE
const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
682 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
683 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
684 #define __Pyx_PyBytes_FromString PyBytes_FromString
685 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
686 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(
const char*);
687 #if PY_MAJOR_VERSION < 3
688 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
689 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
691 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
692 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
694 #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
695 #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
696 #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
697 #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
698 #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
699 #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
700 #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
701 #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
702 #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
703 #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
704 #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
705 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
706 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
707 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
708 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
709 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
710 static CYTHON_INLINE
size_t __Pyx_Py_UNICODE_strlen(
const Py_UNICODE *
u) {
711 const Py_UNICODE *u_end =
u;
713 return (
size_t)(u_end -
u - 1);
715 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
716 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
717 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
718 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
719 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
720 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(
long b);
721 static CYTHON_INLINE
int __Pyx_PyObject_IsTrue(PyObject*);
722 static CYTHON_INLINE
int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
723 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
724 #define __Pyx_PySequence_Tuple(obj)\
725 (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
726 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
727 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(
size_t);
728 #if CYTHON_ASSUME_SAFE_MACROS
729 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
731 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
733 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
734 #if PY_MAJOR_VERSION >= 3
735 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
737 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
739 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
740 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
741 static int __Pyx_sys_getdefaultencoding_not_ascii;
742 static int __Pyx_init_sys_getdefaultencoding_params(
void) {
744 PyObject* default_encoding = NULL;
745 PyObject* ascii_chars_u = NULL;
746 PyObject* ascii_chars_b = NULL;
747 const char* default_encoding_c;
748 sys = PyImport_ImportModule(
"sys");
750 default_encoding = PyObject_CallMethod(sys, (
char*)
"getdefaultencoding", NULL);
752 if (!default_encoding)
goto bad;
753 default_encoding_c = PyBytes_AsString(default_encoding);
754 if (!default_encoding_c)
goto bad;
755 if (strcmp(default_encoding_c,
"ascii") == 0) {
756 __Pyx_sys_getdefaultencoding_not_ascii = 0;
758 char ascii_chars[128];
760 for (
c = 0;
c < 128;
c++) {
763 __Pyx_sys_getdefaultencoding_not_ascii = 1;
764 ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
765 if (!ascii_chars_u)
goto bad;
766 ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
767 if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
770 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
774 Py_DECREF(ascii_chars_u);
775 Py_DECREF(ascii_chars_b);
777 Py_DECREF(default_encoding);
780 Py_XDECREF(default_encoding);
781 Py_XDECREF(ascii_chars_u);
782 Py_XDECREF(ascii_chars_b);
786 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
787 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
789 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
790 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
791 static char* __PYX_DEFAULT_STRING_ENCODING;
792 static int __Pyx_init_sys_getdefaultencoding_params(
void) {
794 PyObject* default_encoding = NULL;
795 char* default_encoding_c;
796 sys = PyImport_ImportModule(
"sys");
798 default_encoding = PyObject_CallMethod(sys, (
char*) (
const char*)
"getdefaultencoding", NULL);
800 if (!default_encoding)
goto bad;
801 default_encoding_c = PyBytes_AsString(default_encoding);
802 if (!default_encoding_c)
goto bad;
803 __PYX_DEFAULT_STRING_ENCODING = (
char*) malloc(strlen(default_encoding_c) + 1);
804 if (!__PYX_DEFAULT_STRING_ENCODING)
goto bad;
805 strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
806 Py_DECREF(default_encoding);
809 Py_XDECREF(default_encoding);
817 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
818 #define likely(x) __builtin_expect(!!(x), 1)
819 #define unlikely(x) __builtin_expect(!!(x), 0)
821 #define likely(x) (x)
822 #define unlikely(x) (x)
824 static CYTHON_INLINE
void __Pyx_pretend_to_initialize(
void* ptr) { (void)ptr; }
826 static PyObject *__pyx_m = NULL;
827 static PyObject *__pyx_d;
828 static PyObject *__pyx_b;
829 static PyObject *__pyx_cython_runtime = NULL;
830 static PyObject *__pyx_empty_tuple;
831 static PyObject *__pyx_empty_bytes;
832 static PyObject *__pyx_empty_unicode;
833 static int __pyx_lineno;
834 static int __pyx_clineno = 0;
835 static const char * __pyx_cfilenm= __FILE__;
836 static const char *__pyx_filename;
839 #if !defined(CYTHON_CCOMPLEX)
840 #if defined(__cplusplus)
841 #define CYTHON_CCOMPLEX 1
842 #elif defined(_Complex_I)
843 #define CYTHON_CCOMPLEX 1
845 #define CYTHON_CCOMPLEX 0
855 #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
857 #define _Complex_I 1.0fj
861 static const char *__pyx_f[] = {
862 "proteus/superluWrappers.pyx",
868 struct __pyx_memoryview_obj;
870 struct __pyx_memoryview_obj *memview;
873 Py_ssize_t strides[8];
874 Py_ssize_t suboffsets[8];
875 } __Pyx_memviewslice;
876 #define __Pyx_MemoryView_Len(m) (m.shape[0])
879 #include <pythread.h>
880 #ifndef CYTHON_ATOMICS
881 #define CYTHON_ATOMICS 1
883 #define __pyx_atomic_int_type int
884 #if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 ||\
885 (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL >= 2)) &&\
887 #define __pyx_atomic_incr_aligned(value, lock) __sync_fetch_and_add(value, 1)
888 #define __pyx_atomic_decr_aligned(value, lock) __sync_fetch_and_sub(value, 1)
889 #ifdef __PYX_DEBUG_ATOMICS
890 #warning "Using GNU atomics"
892 #elif CYTHON_ATOMICS && defined(_MSC_VER) && 0
894 #undef __pyx_atomic_int_type
895 #define __pyx_atomic_int_type LONG
896 #define __pyx_atomic_incr_aligned(value, lock) InterlockedIncrement(value)
897 #define __pyx_atomic_decr_aligned(value, lock) InterlockedDecrement(value)
898 #ifdef __PYX_DEBUG_ATOMICS
899 #pragma message ("Using MSVC atomics")
901 #elif CYTHON_ATOMICS && (defined(__ICC) || defined(__INTEL_COMPILER)) && 0
902 #define __pyx_atomic_incr_aligned(value, lock) _InterlockedIncrement(value)
903 #define __pyx_atomic_decr_aligned(value, lock) _InterlockedDecrement(value)
904 #ifdef __PYX_DEBUG_ATOMICS
905 #warning "Using Intel atomics"
908 #undef CYTHON_ATOMICS
909 #define CYTHON_ATOMICS 0
910 #ifdef __PYX_DEBUG_ATOMICS
911 #warning "Not using atomics"
914 typedef volatile __pyx_atomic_int_type __pyx_atomic_int;
916 #define __pyx_add_acquisition_count(memview)\
917 __pyx_atomic_incr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
918 #define __pyx_sub_acquisition_count(memview)\
919 __pyx_atomic_decr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
921 #define __pyx_add_acquisition_count(memview)\
922 __pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
923 #define __pyx_sub_acquisition_count(memview)\
924 __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
928 #ifndef __PYX_FORCE_INIT_THREADS
929 #define __PYX_FORCE_INIT_THREADS 0
933 #define __Pyx_PyGILState_Ensure PyGILState_Ensure
934 #define __Pyx_PyGILState_Release PyGILState_Release
935 #define __Pyx_FastGIL_Remember()
936 #define __Pyx_FastGIL_Forget()
937 #define __Pyx_FastGilFuncInit()
940 #define IS_UNSIGNED(type) (((type) -1) > 0)
941 struct __Pyx_StructField_;
942 #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
945 struct __Pyx_StructField_* fields;
953 typedef struct __Pyx_StructField_ {
954 __Pyx_TypeInfo* type;
959 __Pyx_StructField* field;
960 size_t parent_offset;
961 } __Pyx_BufFmt_StackElem;
963 __Pyx_StructField root;
964 __Pyx_BufFmt_StackElem* head;
966 size_t new_count, enc_count;
967 size_t struct_alignment;
973 } __Pyx_BufFmt_Context;
983 typedef npy_int8 __pyx_t_5numpy_int8_t;
992 typedef npy_int16 __pyx_t_5numpy_int16_t;
1001 typedef npy_int32 __pyx_t_5numpy_int32_t;
1010 typedef npy_int64 __pyx_t_5numpy_int64_t;
1019 typedef npy_uint8 __pyx_t_5numpy_uint8_t;
1028 typedef npy_uint16 __pyx_t_5numpy_uint16_t;
1037 typedef npy_uint32 __pyx_t_5numpy_uint32_t;
1046 typedef npy_uint64 __pyx_t_5numpy_uint64_t;
1055 typedef npy_float32 __pyx_t_5numpy_float32_t;
1064 typedef npy_float64 __pyx_t_5numpy_float64_t;
1073 typedef npy_long __pyx_t_5numpy_int_t;
1082 typedef npy_longlong __pyx_t_5numpy_long_t;
1091 typedef npy_longlong __pyx_t_5numpy_longlong_t;
1100 typedef npy_ulong __pyx_t_5numpy_uint_t;
1109 typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
1118 typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
1127 typedef npy_intp __pyx_t_5numpy_intp_t;
1136 typedef npy_uintp __pyx_t_5numpy_uintp_t;
1145 typedef npy_double __pyx_t_5numpy_float_t;
1154 typedef npy_double __pyx_t_5numpy_double_t;
1163 typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
1167 typedef ::std::complex< float > __pyx_t_float_complex;
1169 typedef float _Complex __pyx_t_float_complex;
1172 typedef struct {
float real, imag; } __pyx_t_float_complex;
1174 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(
float,
float);
1179 typedef ::std::complex< double > __pyx_t_double_complex;
1181 typedef double _Complex __pyx_t_double_complex;
1184 typedef struct {
double real, imag; } __pyx_t_double_complex;
1186 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(
double,
double);
1190 struct __pyx_obj_15superluWrappers_cSparseMatrix;
1191 struct __pyx_obj_15superluWrappers_SparseFactor;
1192 struct __pyx_array_obj;
1193 struct __pyx_MemviewEnum_obj;
1194 struct __pyx_memoryview_obj;
1195 struct __pyx_memoryviewslice_obj;
1204 typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
1213 typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
1222 typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
1231 typedef npy_cdouble __pyx_t_5numpy_complex_t;
1232 struct __pyx_t_15superluWrappers__NRformat;
1233 struct __pyx_t_15superluWrappers__NCformat;
1234 struct __pyx_t_15superluWrappers__DNformat;
1235 struct __pyx_t_15superluWrappers__NCPformat;
1244 struct __pyx_t_15superluWrappers__NRformat {
1245 __pyx_t_5numpy_int32_t
nnz;
1246 __pyx_t_5numpy_float64_t *nzval;
1247 __pyx_t_5numpy_int32_t *colind;
1248 __pyx_t_5numpy_int32_t *rowptr;
1258 struct __pyx_t_15superluWrappers__NCformat {
1259 __pyx_t_5numpy_int32_t
nnz;
1260 __pyx_t_5numpy_float64_t *nzval;
1261 __pyx_t_5numpy_int32_t *rowind;
1262 __pyx_t_5numpy_int32_t *colptr;
1272 struct __pyx_t_15superluWrappers__DNformat {
1273 __pyx_t_5numpy_int32_t lda;
1284 struct __pyx_t_15superluWrappers__NCPformat {
1285 __pyx_t_5numpy_int32_t
nnz;
1287 __pyx_t_5numpy_int32_t *rowind;
1288 __pyx_t_5numpy_int32_t *colbeg;
1289 __pyx_t_5numpy_int32_t *colend;
1299 struct __pyx_obj_15superluWrappers_cSparseMatrix {
1301 __pyx_t_5numpy_int32_t dim[2];
1302 struct __pyx_t_15superluWrappers__NRformat A;
1313 struct __pyx_obj_15superluWrappers_SparseFactor {
1315 struct __pyx_vtabstruct_15superluWrappers_SparseFactor *__pyx_vtab;
1316 superlu_options_t options;
1324 struct __pyx_t_15superluWrappers__NCformat storeA;
1325 struct __pyx_t_15superluWrappers__DNformat storeX;
1329 unsigned int use_same_perm_c;
1330 unsigned int use_same_sparsity;
1342 struct __pyx_array_obj {
1344 struct __pyx_vtabstruct_array *__pyx_vtab;
1350 Py_ssize_t *_strides;
1351 Py_ssize_t itemsize;
1354 void (*callback_free_data)(
void *);
1356 int dtype_is_object;
1367 struct __pyx_MemviewEnum_obj {
1380 struct __pyx_memoryview_obj {
1382 struct __pyx_vtabstruct_memoryview *__pyx_vtab;
1385 PyObject *_array_interface;
1386 PyThread_type_lock lock;
1387 __pyx_atomic_int acquisition_count[2];
1388 __pyx_atomic_int *acquisition_count_aligned_p;
1391 int dtype_is_object;
1392 __Pyx_TypeInfo *typeinfo;
1403 struct __pyx_memoryviewslice_obj {
1404 struct __pyx_memoryview_obj __pyx_base;
1405 __Pyx_memviewslice from_slice;
1406 PyObject *from_object;
1407 PyObject *(*to_object_func)(
char *);
1408 int (*to_dtype_func)(
char *, PyObject *);
1421 struct __pyx_vtabstruct_15superluWrappers_SparseFactor {
1422 PyObject *(*_set_mat_types)(
struct __pyx_obj_15superluWrappers_SparseFactor *);
1424 static struct __pyx_vtabstruct_15superluWrappers_SparseFactor *__pyx_vtabptr_15superluWrappers_SparseFactor;
1435 struct __pyx_vtabstruct_array {
1436 PyObject *(*get_memview)(
struct __pyx_array_obj *);
1438 static struct __pyx_vtabstruct_array *__pyx_vtabptr_array;
1449 struct __pyx_vtabstruct_memoryview {
1450 char *(*get_item_pointer)(
struct __pyx_memoryview_obj *, PyObject *);
1451 PyObject *(*is_slice)(
struct __pyx_memoryview_obj *, PyObject *);
1452 PyObject *(*setitem_slice_assignment)(
struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1453 PyObject *(*setitem_slice_assign_scalar)(
struct __pyx_memoryview_obj *,
struct __pyx_memoryview_obj *, PyObject *);
1454 PyObject *(*setitem_indexed)(
struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1455 PyObject *(*convert_item_to_object)(
struct __pyx_memoryview_obj *,
char *);
1456 PyObject *(*assign_item_from_object)(
struct __pyx_memoryview_obj *,
char *, PyObject *);
1458 static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview;
1469 struct __pyx_vtabstruct__memoryviewslice {
1470 struct __pyx_vtabstruct_memoryview __pyx_base;
1472 static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;
1476 #ifndef CYTHON_REFNANNY
1477 #define CYTHON_REFNANNY 0
1481 void (*INCREF)(
void*, PyObject*, int);
1482 void (*DECREF)(
void*, PyObject*, int);
1483 void (*GOTREF)(
void*, PyObject*, int);
1484 void (*GIVEREF)(
void*, PyObject*, int);
1485 void* (*SetupContext)(
const char*, int,
const char*);
1486 void (*FinishContext)(
void**);
1487 } __Pyx_RefNannyAPIStruct;
1488 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1489 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(
const char *modname);
1490 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1492 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1494 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1495 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1496 PyGILState_Release(__pyx_gilstate_save);\
1498 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1501 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1502 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1504 #define __Pyx_RefNannyFinishContext()\
1505 __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1506 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1507 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1508 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1509 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1510 #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1511 #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1512 #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1513 #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1515 #define __Pyx_RefNannyDeclarations
1516 #define __Pyx_RefNannySetupContext(name, acquire_gil)
1517 #define __Pyx_RefNannyFinishContext()
1518 #define __Pyx_INCREF(r) Py_INCREF(r)
1519 #define __Pyx_DECREF(r) Py_DECREF(r)
1520 #define __Pyx_GOTREF(r)
1521 #define __Pyx_GIVEREF(r)
1522 #define __Pyx_XINCREF(r) Py_XINCREF(r)
1523 #define __Pyx_XDECREF(r) Py_XDECREF(r)
1524 #define __Pyx_XGOTREF(r)
1525 #define __Pyx_XGIVEREF(r)
1527 #define __Pyx_XDECREF_SET(r, v) do {\
1528 PyObject *tmp = (PyObject *) r;\
1529 r = v; __Pyx_XDECREF(tmp);\
1531 #define __Pyx_DECREF_SET(r, v) do {\
1532 PyObject *tmp = (PyObject *) r;\
1533 r = v; __Pyx_DECREF(tmp);\
1535 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1536 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1539 #if CYTHON_USE_TYPE_SLOTS
1540 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1542 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1546 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1549 static void __Pyx_RaiseArgtupleInvalid(
const char* func_name,
int exact,
1550 Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1553 static void __Pyx_RaiseDoubleKeywordsError(
const char* func_name, PyObject* kw_name);
1556 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1557 PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1558 const char* function_name);
1561 #if CYTHON_USE_TYPE_SLOTS
1562 #define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL)
1563 static CYTHON_INLINE
int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value);
1565 #define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n)
1566 #define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
1570 #if CYTHON_COMPILING_IN_CPYTHON
1571 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1573 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1577 static CYTHON_INLINE
int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1580 #define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d
1581 #define __Pyx_MEMVIEW_DIRECT 1
1582 #define __Pyx_MEMVIEW_PTR 2
1583 #define __Pyx_MEMVIEW_FULL 4
1584 #define __Pyx_MEMVIEW_CONTIG 8
1585 #define __Pyx_MEMVIEW_STRIDED 16
1586 #define __Pyx_MEMVIEW_FOLLOW 32
1587 #define __Pyx_IS_C_CONTIG 1
1588 #define __Pyx_IS_F_CONTIG 2
1589 static int __Pyx_init_memviewslice(
1590 struct __pyx_memoryview_obj *memview,
1592 __Pyx_memviewslice *memviewslice,
1593 int memview_is_new_reference);
1594 static CYTHON_INLINE
int __pyx_add_acquisition_count_locked(
1595 __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
1596 static CYTHON_INLINE
int __pyx_sub_acquisition_count_locked(
1597 __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
1598 #define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p)
1599 #define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview))
1600 #define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__)
1601 #define __PYX_XDEC_MEMVIEW(slice, have_gil) __Pyx_XDEC_MEMVIEW(slice, have_gil, __LINE__)
1602 static CYTHON_INLINE
void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *,
int,
int);
1603 static CYTHON_INLINE
void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *,
int,
int);
1606 #if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
1607 static CYTHON_INLINE PyObject* __Pyx_PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name) {
1609 PyTypeObject *tp = Py_TYPE(obj);
1610 #if PY_MAJOR_VERSION < 3
1611 if (unlikely(PyInstance_Check(obj)))
1612 return __Pyx_PyObject_GetAttrStr(obj, attr_name);
1614 res = _PyType_Lookup(tp, attr_name);
1616 descrgetfunc
f = Py_TYPE(res)->tp_descr_get;
1620 res =
f(res, obj, (PyObject *)tp);
1623 PyErr_SetObject(PyExc_AttributeError, attr_name);
1628 #define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n)
1632 #if CYTHON_FAST_PYCALL
1633 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1634 __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1635 #if 1 || PY_VERSION_HEX < 0x030600B1
1636 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1638 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1640 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1641 (sizeof(char [1 - 2*!(cond)]) - 1)
1642 #ifndef Py_MEMBER_SIZE
1643 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1645 static size_t __pyx_pyframe_localsplus_offset = 0;
1646 #include "frameobject.h"
1647 #define __Pxy_PyFrame_Initialize_Offsets()\
1648 ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1649 (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1650 #define __Pyx_PyFrame_GetLocalsplus(frame)\
1651 (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1655 #if CYTHON_COMPILING_IN_CPYTHON
1656 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1660 #if CYTHON_COMPILING_IN_CPYTHON
1661 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
1663 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
1667 #if CYTHON_FAST_PYCCALL
1668 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1670 #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
1674 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1677 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1678 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1679 __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1680 (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1681 __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1682 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1683 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1684 __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1685 (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1686 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1687 int wraparound,
int boundscheck);
1688 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1689 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1690 __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1691 (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1692 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1693 int wraparound,
int boundscheck);
1694 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1695 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1696 int is_list,
int wraparound,
int boundscheck);
1699 #if CYTHON_USE_TYPE_SLOTS
1700 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
1702 #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key)
1706 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject*
function, PyObject* arg1, PyObject* arg2);
1709 #if !CYTHON_COMPILING_IN_PYPY
1710 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2,
long intval,
int inplace,
int zerodivision_check);
1712 #define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
1713 (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
1717 #if CYTHON_USE_EXC_INFO_STACK
1718 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1722 #if CYTHON_FAST_THREAD_STATE
1723 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1724 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1725 #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
1727 #define __Pyx_PyThreadState_declare
1728 #define __Pyx_PyThreadState_assign
1729 #define __Pyx_PyErr_Occurred() PyErr_Occurred()
1733 #if CYTHON_FAST_THREAD_STATE
1734 #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1735 static CYTHON_INLINE
void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1736 #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1737 static CYTHON_INLINE
void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1739 #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
1740 #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
1744 #if CYTHON_FAST_THREAD_STATE
1745 #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
1746 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1748 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1752 #if CYTHON_FAST_THREAD_STATE
1753 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1754 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1755 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1756 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1757 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1758 static CYTHON_INLINE
void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1759 static CYTHON_INLINE
void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1760 #if CYTHON_COMPILING_IN_CPYTHON
1761 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1763 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1766 #define __Pyx_PyErr_Clear() PyErr_Clear()
1767 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1768 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1769 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1770 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1771 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1772 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1773 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1777 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(
1778 PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop,
1779 PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
1780 int has_cstart,
int has_cstop,
int wraparound);
1783 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1786 static void __Pyx_WriteUnraisable(
const char *name,
int clineno,
1787 int lineno,
const char *filename,
1788 int full_traceback,
int nogil);
1791 #if CYTHON_FAST_THREAD_STATE
1792 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1793 static CYTHON_INLINE
int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1795 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1799 #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
1800 ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
1801 __Pyx__ArgTypeTest(obj, type, name, exact))
1802 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type,
const char *name,
int exact);
1808 static CYTHON_INLINE
int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2,
int equals);
1811 static CYTHON_INLINE
int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2,
int equals);
1814 #if PY_MAJOR_VERSION >= 3
1815 #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
1817 #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
1821 static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t);
1824 #define UNARY_NEG_WOULD_OVERFLOW(x)\
1825 (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))
1827 static CYTHON_UNUSED
int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
1828 static PyObject *__pyx_array_get_memview(
struct __pyx_array_obj *);
1830 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
1833 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(
const char *
s, Py_ssize_t size,
const char *errors) {
1835 return PyUnicode_DecodeUTF16(
s, size, errors, &byteorder);
1837 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(
const char *
s, Py_ssize_t size,
const char *errors) {
1839 return PyUnicode_DecodeUTF16(
s, size, errors, &byteorder);
1841 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(
const char *
s, Py_ssize_t size,
const char *errors) {
1843 return PyUnicode_DecodeUTF16(
s, size, errors, &byteorder);
1847 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
1848 const char* cstring, Py_ssize_t start, Py_ssize_t stop,
1849 const char* encoding,
const char* errors,
1850 PyObject* (*decode_func)(
const char *
s, Py_ssize_t size,
const char *errors));
1853 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
1856 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1857 #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
1858 #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
1859 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1860 (version_var) = __PYX_GET_DICT_VERSION(dict);\
1861 (cache_var) = (value);
1862 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1863 static PY_UINT64_T __pyx_dict_version = 0;\
1864 static PyObject *__pyx_dict_cached_value = NULL;\
1865 if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1866 (VAR) = __pyx_dict_cached_value;\
1868 (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1869 __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1872 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1873 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1874 static CYTHON_INLINE
int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1876 #define __PYX_GET_DICT_VERSION(dict) (0)
1877 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1878 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
1882 #if CYTHON_USE_DICT_VERSIONS
1883 #define __Pyx_GetModuleGlobalName(var, name) {\
1884 static PY_UINT64_T __pyx_dict_version = 0;\
1885 static PyObject *__pyx_dict_cached_value = NULL;\
1886 (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1887 (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1888 __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1890 #define __Pyx_GetModuleGlobalNameUncached(var, name) {\
1891 PY_UINT64_T __pyx_dict_version;\
1892 PyObject *__pyx_dict_cached_value;\
1893 (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1895 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1897 #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1898 #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1899 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1903 static CYTHON_INLINE
void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1906 static CYTHON_INLINE
void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1909 static CYTHON_INLINE
void __Pyx_RaiseNoneNotIterableError(
void);
1912 #if CYTHON_FAST_THREAD_STATE
1913 #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
1914 static CYTHON_INLINE
void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1916 static CYTHON_INLINE
void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
1920 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list,
int level);
1923 #if CYTHON_COMPILING_IN_CPYTHON
1924 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1925 static CYTHON_INLINE
int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1926 static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1927 static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1929 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1930 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1931 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1933 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1935 static CYTHON_UNUSED
int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
1937 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
1938 static CYTHON_INLINE
int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
1939 PyListObject*
L = (PyListObject*) list;
1940 Py_ssize_t len = Py_SIZE(list);
1941 if (likely(
L->allocated > len)) {
1943 PyList_SET_ITEM(list, len, x);
1944 __Pyx_SET_SIZE(list, len + 1);
1947 return PyList_Append(list, x);
1950 #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
1954 static CYTHON_INLINE
int __Pyx_PyList_Extend(PyObject*
L, PyObject*
v) {
1955 #if CYTHON_COMPILING_IN_CPYTHON
1956 PyObject* none = _PyList_Extend((PyListObject*)
L,
v);
1957 if (unlikely(!none))
1962 return PyList_SetSlice(
L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX,
v);
1967 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
1968 static CYTHON_INLINE
int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
1969 PyListObject*
L = (PyListObject*) list;
1970 Py_ssize_t len = Py_SIZE(list);
1971 if (likely(
L->allocated > len) & likely(len > (
L->allocated >> 1))) {
1973 PyList_SET_ITEM(list, len, x);
1974 __Pyx_SET_SIZE(list, len + 1);
1977 return PyList_Append(list, x);
1980 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
1984 static CYTHON_INLINE
void __Pyx_RaiseUnboundLocalError(
const char *varname);
1987 static CYTHON_INLINE
long __Pyx_div_long(
long,
long);
1990 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1993 static CYTHON_INLINE
int __Pyx_HasAttr(PyObject *, PyObject *);
1996 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1997 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
1999 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
2003 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
2004 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
2006 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
2010 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
2013 static int __Pyx_setup_reduce(PyObject* type_obj);
2016 static int __Pyx_SetVtable(PyObject *dict,
void *vtable);
2019 #ifndef __PYX_HAVE_RT_ImportType_proto
2020 #define __PYX_HAVE_RT_ImportType_proto
2021 enum __Pyx_ImportType_CheckSize {
2022 __Pyx_ImportType_CheckSize_Error = 0,
2023 __Pyx_ImportType_CheckSize_Warn = 1,
2024 __Pyx_ImportType_CheckSize_Ignore = 2
2026 static PyTypeObject *__Pyx_ImportType(PyObject* module,
const char *module_name,
const char *class_name,
size_t size,
enum __Pyx_ImportType_CheckSize check_size);
2030 static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);
2033 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
2036 #define __Pyx_CyFunction_USED 1
2037 #define __Pyx_CYFUNCTION_STATICMETHOD 0x01
2038 #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02
2039 #define __Pyx_CYFUNCTION_CCLASS 0x04
2040 #define __Pyx_CyFunction_GetClosure(f)\
2041 (((__pyx_CyFunctionObject *) (f))->func_closure)
2042 #define __Pyx_CyFunction_GetClassObj(f)\
2043 (((__pyx_CyFunctionObject *) (f))->func_classobj)
2044 #define __Pyx_CyFunction_Defaults(type, f)\
2045 ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
2046 #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
2047 ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
2049 PyCFunctionObject func;
2050 #if PY_VERSION_HEX < 0x030500A0
2051 PyObject *func_weakreflist;
2053 PyObject *func_dict;
2054 PyObject *func_name;
2055 PyObject *func_qualname;
2057 PyObject *func_globals;
2058 PyObject *func_code;
2059 PyObject *func_closure;
2060 PyObject *func_classobj;
2062 int defaults_pyobjects;
2063 size_t defaults_size;
2065 PyObject *defaults_tuple;
2066 PyObject *defaults_kwdict;
2067 PyObject *(*defaults_getter)(PyObject *);
2068 PyObject *func_annotations;
2069 } __pyx_CyFunctionObject;
2070 static PyTypeObject *__pyx_CyFunctionType = 0;
2071 #define __Pyx_CyFunction_Check(obj) (__Pyx_TypeCheck(obj, __pyx_CyFunctionType))
2072 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
2073 int flags, PyObject* qualname,
2075 PyObject *module, PyObject *globals,
2077 static CYTHON_INLINE
void *__Pyx_CyFunction_InitDefaults(PyObject *m,
2080 static CYTHON_INLINE
void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
2082 static CYTHON_INLINE
void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
2084 static CYTHON_INLINE
void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
2086 static int __pyx_CyFunction_init(
void);
2089 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
2090 int flags, PyObject* qualname,
2092 PyObject *module, PyObject *globals,
2096 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
2097 #define __Pyx_SetNameInClass(ns, name, value)\
2098 (likely(PyDict_CheckExact(ns)) ? _PyDict_SetItem_KnownHash(ns, name, value, ((PyASCIIObject *) name)->hash) : PyObject_SetItem(ns, name, value))
2099 #elif CYTHON_COMPILING_IN_CPYTHON
2100 #define __Pyx_SetNameInClass(ns, name, value)\
2101 (likely(PyDict_CheckExact(ns)) ? PyDict_SetItem(ns, name, value) : PyObject_SetItem(ns, name, value))
2103 #define __Pyx_SetNameInClass(ns, name, value) PyObject_SetItem(ns, name, value)
2107 static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
2108 PyObject *mkw, PyObject *modname, PyObject *doc);
2109 static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
2110 PyObject *mkw,
int calculate_metaclass,
int allow_py2_metaclass);
2113 #ifdef CYTHON_CLINE_IN_TRACEBACK
2114 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
2116 static int __Pyx_CLineForTraceback(PyThreadState *tstate,
int c_line);
2121 PyCodeObject* code_object;
2123 } __Pyx_CodeObjectCacheEntry;
2124 struct __Pyx_CodeObjectCache {
2127 __Pyx_CodeObjectCacheEntry* entries;
2129 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
2130 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries,
int count,
int code_line);
2131 static PyCodeObject *__pyx_find_code_object(
int code_line);
2132 static void __pyx_insert_code_object(
int code_line, PyCodeObject* code_object);
2135 static void __Pyx_AddTraceback(
const char *funcname,
int c_line,
2136 int py_line,
const char *filename);
2138 #if PY_MAJOR_VERSION < 3
2139 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view,
int flags);
2140 static void __Pyx_ReleaseBuffer(Py_buffer *view);
2142 #define __Pyx_GetBuffer PyObject_GetBuffer
2143 #define __Pyx_ReleaseBuffer PyBuffer_Release
2149 Py_ssize_t shape, strides, suboffsets;
2150 } __Pyx_Buf_DimInfo;
2156 __Pyx_Buffer *rcbuffer;
2158 __Pyx_Buf_DimInfo diminfo[8];
2159 } __Pyx_LocalBuf_ND;
2162 static int __pyx_memviewslice_is_contig(
const __Pyx_memviewslice mvs,
char order,
int ndim);
2165 static int __pyx_slices_overlap(__Pyx_memviewslice *slice1,
2166 __Pyx_memviewslice *slice2,
2167 int ndim,
size_t itemsize);
2170 static CYTHON_INLINE PyObject *__pyx_capsule_create(
void *p,
const char *sig);
2173 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
2174 #define __Pyx_HAS_GCC_DIAGNOSTIC
2178 static CYTHON_INLINE
int __Pyx_Is_Little_Endian(
void);
2181 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx,
const char* ts);
2182 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
2183 __Pyx_BufFmt_StackElem* stack,
2184 __Pyx_TypeInfo* type);
2187 static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
2190 static int __Pyx_ValidateAndInit_memviewslice(
2195 __Pyx_TypeInfo *dtype,
2196 __Pyx_BufFmt_StackElem stack[],
2197 __Pyx_memviewslice *memviewslice,
2198 PyObject *original_obj);
2201 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(PyObject *,
int writable_flag);
2204 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int32_t(PyObject *,
int writable_flag);
2209 #define __Pyx_CREAL(z) ((z).real())
2210 #define __Pyx_CIMAG(z) ((z).imag())
2212 #define __Pyx_CREAL(z) (__real__(z))
2213 #define __Pyx_CIMAG(z) (__imag__(z))
2216 #define __Pyx_CREAL(z) ((z).real)
2217 #define __Pyx_CIMAG(z) ((z).imag)
2219 #if defined(__cplusplus) && CYTHON_CCOMPLEX\
2220 && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
2221 #define __Pyx_SET_CREAL(z,x) ((z).real(x))
2222 #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
2224 #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
2225 #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
2230 #define __Pyx_c_eq_float(a, b) ((a)==(b))
2231 #define __Pyx_c_sum_float(a, b) ((a)+(b))
2232 #define __Pyx_c_diff_float(a, b) ((a)-(b))
2233 #define __Pyx_c_prod_float(a, b) ((a)*(b))
2234 #define __Pyx_c_quot_float(a, b) ((a)/(b))
2235 #define __Pyx_c_neg_float(a) (-(a))
2237 #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
2238 #define __Pyx_c_conj_float(z) (::std::conj(z))
2240 #define __Pyx_c_abs_float(z) (::std::abs(z))
2241 #define __Pyx_c_pow_float(a, b) (::std::pow(a, b))
2244 #define __Pyx_c_is_zero_float(z) ((z)==0)
2245 #define __Pyx_c_conj_float(z) (conjf(z))
2247 #define __Pyx_c_abs_float(z) (cabsf(z))
2248 #define __Pyx_c_pow_float(a, b) (cpowf(a, b))
2252 static CYTHON_INLINE
int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
2253 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
2254 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
2255 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
2256 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
2257 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
2258 static CYTHON_INLINE
int __Pyx_c_is_zero_float(__pyx_t_float_complex);
2259 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
2261 static CYTHON_INLINE
float __Pyx_c_abs_float(__pyx_t_float_complex);
2262 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
2268 #define __Pyx_c_eq_double(a, b) ((a)==(b))
2269 #define __Pyx_c_sum_double(a, b) ((a)+(b))
2270 #define __Pyx_c_diff_double(a, b) ((a)-(b))
2271 #define __Pyx_c_prod_double(a, b) ((a)*(b))
2272 #define __Pyx_c_quot_double(a, b) ((a)/(b))
2273 #define __Pyx_c_neg_double(a) (-(a))
2275 #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
2276 #define __Pyx_c_conj_double(z) (::std::conj(z))
2278 #define __Pyx_c_abs_double(z) (::std::abs(z))
2279 #define __Pyx_c_pow_double(a, b) (::std::pow(a, b))
2282 #define __Pyx_c_is_zero_double(z) ((z)==0)
2283 #define __Pyx_c_conj_double(z) (conj(z))
2285 #define __Pyx_c_abs_double(z) (cabs(z))
2286 #define __Pyx_c_pow_double(a, b) (cpow(a, b))
2290 static CYTHON_INLINE
int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
2291 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
2292 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
2293 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
2294 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
2295 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
2296 static CYTHON_INLINE
int __Pyx_c_is_zero_double(__pyx_t_double_complex);
2297 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
2299 static CYTHON_INLINE
double __Pyx_c_abs_double(__pyx_t_double_complex);
2300 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
2305 static __Pyx_memviewslice
2306 __pyx_memoryview_copy_new_contig(
const __Pyx_memviewslice *from_mvs,
2307 const char *mode,
int ndim,
2308 size_t sizeof_dtype,
int contig_flag,
2309 int dtype_is_object);
2312 static CYTHON_INLINE
int __Pyx_PyInt_As_int(PyObject *);
2315 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_int32(npy_int32 value);
2318 static CYTHON_INLINE npy_int32 __Pyx_PyInt_As_npy_int32(PyObject *);
2321 static CYTHON_INLINE
size_t __Pyx_PyInt_As_size_t(PyObject *);
2324 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(
int value);
2327 static CYTHON_INLINE
long __Pyx_PyInt_As_long(PyObject *);
2330 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(
long value);
2333 static CYTHON_INLINE
char __Pyx_PyInt_As_char(PyObject *);
2336 static int __Pyx_check_binary_version(
void);
2339 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
2341 static PyObject *__pyx_f_15superluWrappers_12SparseFactor__set_mat_types(
struct __pyx_obj_15superluWrappers_SparseFactor *__pyx_v_self);
2342 static PyObject *__pyx_array_get_memview(
struct __pyx_array_obj *__pyx_v_self);
2343 static char *__pyx_memoryview_get_item_pointer(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index);
2344 static PyObject *__pyx_memoryview_is_slice(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj);
2345 static PyObject *__pyx_memoryview_setitem_slice_assignment(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src);
2346 static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(
struct __pyx_memoryview_obj *__pyx_v_self,
struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value);
2347 static PyObject *__pyx_memoryview_setitem_indexed(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value);
2348 static PyObject *__pyx_memoryview_convert_item_to_object(
struct __pyx_memoryview_obj *__pyx_v_self,
char *__pyx_v_itemp);
2349 static PyObject *__pyx_memoryview_assign_item_from_object(
struct __pyx_memoryview_obj *__pyx_v_self,
char *__pyx_v_itemp, PyObject *__pyx_v_value);
2350 static PyObject *__pyx_memoryviewslice_convert_item_to_object(
struct __pyx_memoryviewslice_obj *__pyx_v_self,
char *__pyx_v_itemp);
2351 static PyObject *__pyx_memoryviewslice_assign_item_from_object(
struct __pyx_memoryviewslice_obj *__pyx_v_self,
char *__pyx_v_itemp, PyObject *__pyx_v_value);
2362 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
2375 static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
2376 static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
2377 static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
2378 static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
2379 static PyTypeObject *__pyx_ptype_5numpy_generic = 0;
2380 static PyTypeObject *__pyx_ptype_5numpy_number = 0;
2381 static PyTypeObject *__pyx_ptype_5numpy_integer = 0;
2382 static PyTypeObject *__pyx_ptype_5numpy_signedinteger = 0;
2383 static PyTypeObject *__pyx_ptype_5numpy_unsignedinteger = 0;
2384 static PyTypeObject *__pyx_ptype_5numpy_inexact = 0;
2385 static PyTypeObject *__pyx_ptype_5numpy_floating = 0;
2386 static PyTypeObject *__pyx_ptype_5numpy_complexfloating = 0;
2387 static PyTypeObject *__pyx_ptype_5numpy_flexible = 0;
2388 static PyTypeObject *__pyx_ptype_5numpy_character = 0;
2389 static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
2398 static PyTypeObject *__pyx_ptype_15superluWrappers_cSparseMatrix = 0;
2399 static PyTypeObject *__pyx_ptype_15superluWrappers_SparseFactor = 0;
2400 static PyTypeObject *__pyx_array_type = 0;
2401 static PyTypeObject *__pyx_MemviewEnum_type = 0;
2402 static PyTypeObject *__pyx_memoryview_type = 0;
2403 static PyTypeObject *__pyx_memoryviewslice_type = 0;
2404 static PyObject *
generic = 0;
2405 static PyObject *strided = 0;
2406 static PyObject *indirect = 0;
2407 static PyObject *contiguous = 0;
2408 static PyObject *indirect_contiguous = 0;
2409 static int __pyx_memoryview_thread_locks_used;
2410 static PyThread_type_lock __pyx_memoryview_thread_locks[8];
2411 static void __pyx_f_15superluWrappers_SparseMatrix_matvec(
struct __pyx_obj_15superluWrappers_cSparseMatrix *, __Pyx_memviewslice, __Pyx_memviewslice);
2412 static void __pyx_f_15superluWrappers_superluWrappersSparseFactorPrepare(
struct __pyx_obj_15superluWrappers_cSparseMatrix *,
struct __pyx_obj_15superluWrappers_SparseFactor *);
2413 static void __pyx_f_15superluWrappers_superluWrappersSparseFactorSolve(
struct __pyx_obj_15superluWrappers_SparseFactor *, __Pyx_memviewslice);
2414 static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t,
char *,
char *,
char *);
2415 static void *__pyx_align_pointer(
void *,
size_t);
2416 static PyObject *__pyx_memoryview_new(PyObject *,
int,
int, __Pyx_TypeInfo *);
2417 static CYTHON_INLINE
int __pyx_memoryview_check(PyObject *);
2418 static PyObject *_unellipsify(PyObject *,
int);
2419 static PyObject *assert_direct_dimensions(Py_ssize_t *,
int);
2420 static struct __pyx_memoryview_obj *__pyx_memview_slice(
struct __pyx_memoryview_obj *, PyObject *);
2421 static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t,
int,
int,
int *, Py_ssize_t, Py_ssize_t, Py_ssize_t,
int,
int,
int,
int);
2422 static char *__pyx_pybuffer_index(Py_buffer *,
char *, Py_ssize_t, Py_ssize_t);
2423 static int __pyx_memslice_transpose(__Pyx_memviewslice *);
2424 static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice,
int, PyObject *(*)(
char *),
int (*)(
char *, PyObject *),
int);
2425 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(
struct __pyx_memoryview_obj *, __Pyx_memviewslice *);
2426 static void __pyx_memoryview_slice_copy(
struct __pyx_memoryview_obj *, __Pyx_memviewslice *);
2427 static PyObject *__pyx_memoryview_copy_object(
struct __pyx_memoryview_obj *);
2428 static PyObject *__pyx_memoryview_copy_object_from_slice(
struct __pyx_memoryview_obj *, __Pyx_memviewslice *);
2429 static Py_ssize_t abs_py_ssize_t(Py_ssize_t);
2430 static char __pyx_get_best_slice_order(__Pyx_memviewslice *,
int);
2431 static void _copy_strided_to_strided(
char *, Py_ssize_t *,
char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *,
int,
size_t);
2432 static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *,
int,
size_t);
2433 static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *,
int);
2434 static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t,
int,
char);
2435 static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *,
char,
int);
2436 static int __pyx_memoryview_err_extents(
int, Py_ssize_t, Py_ssize_t);
2437 static int __pyx_memoryview_err_dim(PyObject *,
char *,
int);
2438 static int __pyx_memoryview_err(PyObject *,
char *);
2439 static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice,
int,
int,
int);
2440 static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *,
int,
int);
2441 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *,
int,
int,
int);
2442 static void __pyx_memoryview_refcount_objects_in_slice_with_gil(
char *, Py_ssize_t *, Py_ssize_t *,
int,
int);
2443 static void __pyx_memoryview_refcount_objects_in_slice(
char *, Py_ssize_t *, Py_ssize_t *,
int,
int);
2444 static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *,
int,
size_t,
void *,
int);
2445 static void __pyx_memoryview__slice_assign_scalar(
char *, Py_ssize_t *, Py_ssize_t *,
int,
size_t,
void *);
2446 static PyObject *__pyx_unpickle_Enum__set_state(
struct __pyx_MemviewEnum_obj *, PyObject *);
2447 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t = {
"float64_t", NULL,
sizeof(__pyx_t_5numpy_float64_t), { 0 }, 0,
'R', 0, 0 };
2448 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t = {
"int32_t", NULL,
sizeof(__pyx_t_5numpy_int32_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_int32_t) ?
'U' :
'I', IS_UNSIGNED(__pyx_t_5numpy_int32_t), 0 };
2449 #define __Pyx_MODULE_NAME "superluWrappers"
2450 extern int __pyx_module_is_main_superluWrappers;
2451 int __pyx_module_is_main_superluWrappers = 0;
2454 static PyObject *__pyx_builtin_object;
2455 static PyObject *__pyx_builtin_open;
2456 static PyObject *__pyx_builtin_range;
2457 static PyObject *__pyx_builtin_TypeError;
2458 static PyObject *__pyx_builtin_ImportError;
2459 static PyObject *__pyx_builtin_ValueError;
2460 static PyObject *__pyx_builtin_MemoryError;
2461 static PyObject *__pyx_builtin_enumerate;
2462 static PyObject *__pyx_builtin_Ellipsis;
2463 static PyObject *__pyx_builtin_id;
2464 static PyObject *__pyx_builtin_IndexError;
2465 static const char __pyx_k_O[] =
"O";
2466 static const char __pyx_k_c[] =
"c";
2467 static const char __pyx_k_i[] =
"i";
2468 static const char __pyx_k_k[] =
"k";
2469 static const char __pyx_k_w[] =
"w";
2470 static const char __pyx_k_x[] =
"x";
2471 static const char __pyx_k_y[] =
"y";
2472 static const char __pyx_k_id[] =
"id";
2473 static const char __pyx_k_nc[] =
"nc";
2474 static const char __pyx_k_np[] =
"np";
2475 static const char __pyx_k_nr[] =
"nr";
2476 static const char __pyx_k_dim[] =
"dim";
2477 static const char __pyx_k_doc[] =
"__doc__";
2478 static const char __pyx_k_new[] =
"__new__";
2479 static const char __pyx_k_nnz[] =
"nnz";
2480 static const char __pyx_k_obj[] =
"obj";
2481 static const char __pyx_k_base[] =
"base";
2482 static const char __pyx_k_dict[] =
"__dict__";
2483 static const char __pyx_k_exit[] =
"__exit__";
2484 static const char __pyx_k_init[] =
"__init__";
2485 static const char __pyx_k_main[] =
"__main__";
2486 static const char __pyx_k_mode[] =
"mode";
2487 static const char __pyx_k_name[] =
"name";
2488 static const char __pyx_k_ndim[] =
"ndim";
2489 static const char __pyx_k_open[] =
"open";
2490 static const char __pyx_k_pack[] =
"pack";
2491 static const char __pyx_k_rows[] =
"_rows";
2492 static const char __pyx_k_self[] =
"self";
2493 static const char __pyx_k_size[] =
"size";
2494 static const char __pyx_k_step[] =
"step";
2495 static const char __pyx_k_stop[] =
"stop";
2496 static const char __pyx_k_test[] =
"__test__";
2497 static const char __pyx_k_ASCII[] =
"ASCII";
2498 static const char __pyx_k_class[] =
"__class__";
2499 static const char __pyx_k_enter[] =
"__enter__";
2500 static const char __pyx_k_error[] =
"error";
2501 static const char __pyx_k_flags[] =
"flags";
2502 static const char __pyx_k_i_i_i[] =
"%i %i %i \n";
2503 static const char __pyx_k_numpy[] =
"numpy";
2504 static const char __pyx_k_nzval[] =
"nzval";
2505 static const char __pyx_k_range[] =
"range";
2506 static const char __pyx_k_shape[] =
"shape";
2507 static const char __pyx_k_start[] =
"start";
2508 static const char __pyx_k_write[] =
"write";
2509 static const char __pyx_k_colind[] =
"colind";
2510 static const char __pyx_k_encode[] =
"encode";
2511 static const char __pyx_k_format[] =
"format";
2512 static const char __pyx_k_fwrite[] =
"fwrite";
2513 static const char __pyx_k_import[] =
"__import__";
2514 static const char __pyx_k_matvec[] =
"matvec";
2515 static const char __pyx_k_module[] =
"__module__";
2516 static const char __pyx_k_name_2[] =
"__name__";
2517 static const char __pyx_k_nzvals[] =
"nzvals";
2518 static const char __pyx_k_object[] =
"object";
2519 static const char __pyx_k_pickle[] =
"pickle";
2520 static const char __pyx_k_reduce[] =
"__reduce__";
2521 static const char __pyx_k_rowptr[] =
"rowptr";
2522 static const char __pyx_k_struct[] =
"struct";
2523 static const char __pyx_k_unpack[] =
"unpack";
2524 static const char __pyx_k_update[] =
"update";
2525 static const char __pyx_k_fortran[] =
"fortran";
2526 static const char __pyx_k_memview[] =
"memview";
2527 static const char __pyx_k_prepare[] =
"__prepare__";
2528 static const char __pyx_k_Ellipsis[] =
"Ellipsis";
2529 static const char __pyx_k_filename[] =
"filename";
2530 static const char __pyx_k_getstate[] =
"__getstate__";
2531 static const char __pyx_k_itemsize[] =
"itemsize";
2532 static const char __pyx_k_pyx_type[] =
"__pyx_type";
2533 static const char __pyx_k_qualname[] =
"__qualname__";
2534 static const char __pyx_k_setstate[] =
"__setstate__";
2535 static const char __pyx_k_TypeError[] =
"TypeError";
2536 static const char __pyx_k_d_d_13_8e[] =
"%d %d %13.8e\n";
2537 static const char __pyx_k_enumerate[] =
"enumerate";
2538 static const char __pyx_k_metaclass[] =
"__metaclass__";
2539 static const char __pyx_k_pyx_state[] =
"__pyx_state";
2540 static const char __pyx_k_range_end[] =
"range_end";
2541 static const char __pyx_k_reduce_ex[] =
"__reduce_ex__";
2542 static const char __pyx_k_IndexError[] =
"IndexError";
2543 static const char __pyx_k_ValueError[] =
"ValueError";
2544 static const char __pyx_k_pyx_result[] =
"__pyx_result";
2545 static const char __pyx_k_pyx_vtable[] =
"__pyx_vtable__";
2546 static const char __pyx_k_ImportError[] =
"ImportError";
2547 static const char __pyx_k_MemoryError[] =
"MemoryError";
2548 static const char __pyx_k_PickleError[] =
"PickleError";
2549 static const char __pyx_k_output_file[] =
"output_file";
2550 static const char __pyx_k_range_start[] =
"range_start";
2551 static const char __pyx_k_SparseFactor[] =
"SparseFactor";
2552 static const char __pyx_k_SparseMatrix[] =
"SparseMatrix";
2553 static const char __pyx_k_pyx_checksum[] =
"__pyx_checksum";
2554 static const char __pyx_k_sparseFactor[] =
"sparseFactor";
2555 static const char __pyx_k_stringsource[] =
"stringsource";
2556 static const char __pyx_k_cSparseMatrix[] =
"_cSparseMatrix";
2557 static const char __pyx_k_pyx_getbuffer[] =
"__pyx_getbuffer";
2558 static const char __pyx_k_reduce_cython[] =
"__reduce_cython__";
2559 static const char __pyx_k_sparse_matrix[] =
"sparse_matrix";
2560 static const char __pyx_k_View_MemoryView[] =
"View.MemoryView";
2561 static const char __pyx_k_allocate_buffer[] =
"allocate_buffer";
2562 static const char __pyx_k_cSparseMatrix_2[] =
"cSparseMatrix";
2563 static const char __pyx_k_dtype_is_object[] =
"dtype_is_object";
2564 static const char __pyx_k_pyx_PickleError[] =
"__pyx_PickleError";
2565 static const char __pyx_k_setstate_cython[] =
"__setstate_cython__";
2566 static const char __pyx_k_superluWrappers[] =
"superluWrappers";
2567 static const char __pyx_k_pyx_unpickle_Enum[] =
"__pyx_unpickle_Enum";
2568 static const char __pyx_k_sparseFactorSolve[] =
"sparseFactorSolve";
2569 static const char __pyx_k_cline_in_traceback[] =
"cline_in_traceback";
2570 static const char __pyx_k_strided_and_direct[] =
"<strided and direct>";
2571 static const char __pyx_k_SparseMatrix___init[] =
"SparseMatrix.__init__";
2572 static const char __pyx_k_SparseMatrix_fwrite[] =
"SparseMatrix.fwrite";
2573 static const char __pyx_k_SparseMatrix_matvec[] =
"SparseMatrix.matvec";
2574 static const char __pyx_k_sparseFactorPrepare[] =
"sparseFactorPrepare";
2575 static const char __pyx_k_getCSRrepresentation[] =
"getCSRrepresentation";
2576 static const char __pyx_k_strided_and_indirect[] =
"<strided and indirect>";
2577 static const char __pyx_k_contiguous_and_direct[] =
"<contiguous and direct>";
2578 static const char __pyx_k_MemoryView_of_r_object[] =
"<MemoryView of %r object>";
2579 static const char __pyx_k_MemoryView_of_r_at_0x_x[] =
"<MemoryView of %r at 0x%x>";
2580 static const char __pyx_k_contiguous_and_indirect[] =
"<contiguous and indirect>";
2581 static const char __pyx_k_Cannot_index_with_type_s[] =
"Cannot index with type '%s'";
2582 static const char __pyx_k_Invalid_shape_in_axis_d_d[] =
"Invalid shape in axis %d: %d.";
2583 static const char __pyx_k_getSubMatCSRrepresentation[] =
"getSubMatCSRrepresentation";
2584 static const char __pyx_k_itemsize_0_for_cython_array[] =
"itemsize <= 0 for cython.array";
2585 static const char __pyx_k_proteus_superluWrappers_pyx[] =
"proteus/superluWrappers.pyx";
2586 static const char __pyx_k_unable_to_allocate_array_data[] =
"unable to allocate array data.";
2587 static const char __pyx_k_strided_and_direct_or_indirect[] =
"<strided and direct or indirect>";
2588 static const char __pyx_k_numpy_core_multiarray_failed_to[] =
"numpy.core.multiarray failed to import";
2589 static const char __pyx_k_Buffer_view_does_not_expose_stri[] =
"Buffer view does not expose strides";
2590 static const char __pyx_k_Can_only_create_a_buffer_that_is[] =
"Can only create a buffer that is contiguous in memory.";
2591 static const char __pyx_k_Cannot_assign_to_read_only_memor[] =
"Cannot assign to read-only memoryview";
2592 static const char __pyx_k_Cannot_create_writable_memory_vi[] =
"Cannot create writable memory view from read-only memoryview";
2593 static const char __pyx_k_Empty_shape_tuple_for_cython_arr[] =
"Empty shape tuple for cython.array";
2594 static const char __pyx_k_Incompatible_checksums_s_vs_0xb0[] =
"Incompatible checksums (%s vs 0xb068931 = (name))";
2595 static const char __pyx_k_Indirect_dimensions_not_supporte[] =
"Indirect dimensions not supported";
2596 static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] =
"Invalid mode, expected 'c' or 'fortran', got %s";
2597 static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] =
"Out of bounds on buffer access (axis %d)";
2598 static const char __pyx_k_SparseMatrix_getCSRrepresentatio[] =
"SparseMatrix.getCSRrepresentation";
2599 static const char __pyx_k_SparseMatrix_getSubMatCSRreprese[] =
"SparseMatrix.getSubMatCSRrepresentation";
2600 static const char __pyx_k_Unable_to_convert_item_to_object[] =
"Unable to convert item to object";
2601 static const char __pyx_k_got_differing_extents_in_dimensi[] =
"got differing extents in dimension %d (got %d and %d)";
2602 static const char __pyx_k_no_default___reduce___due_to_non[] =
"no default __reduce__ due to non-trivial __cinit__";
2603 static const char __pyx_k_numpy_core_umath_failed_to_impor[] =
"numpy.core.umath failed to import";
2604 static const char __pyx_k_self_A_self_AC_self_L_self_U_sel[] =
"self.A,self.AC,self.L,self.U,self.X,self.etree,self.perm_c,self.perm_r,self.storeA,self.storeX cannot be converted to a Python object for pickling";
2605 static const char __pyx_k_unable_to_allocate_shape_and_str[] =
"unable to allocate shape and strides.";
2606 static PyObject *__pyx_n_s_ASCII;
2607 static PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri;
2608 static PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is;
2609 static PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor;
2610 static PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi;
2611 static PyObject *__pyx_kp_s_Cannot_index_with_type_s;
2612 static PyObject *__pyx_n_s_Ellipsis;
2613 static PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr;
2614 static PyObject *__pyx_n_s_ImportError;
2615 static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xb0;
2616 static PyObject *__pyx_n_s_IndexError;
2617 static PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte;
2618 static PyObject *__pyx_kp_s_Invalid_mode_expected_c_or_fortr;
2619 static PyObject *__pyx_kp_s_Invalid_shape_in_axis_d_d;
2620 static PyObject *__pyx_n_s_MemoryError;
2621 static PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x;
2622 static PyObject *__pyx_kp_s_MemoryView_of_r_object;
2623 static PyObject *__pyx_n_b_O;
2624 static PyObject *__pyx_kp_s_Out_of_bounds_on_buffer_access_a;
2625 static PyObject *__pyx_n_s_PickleError;
2626 static PyObject *__pyx_n_s_SparseFactor;
2627 static PyObject *__pyx_n_s_SparseMatrix;
2628 static PyObject *__pyx_n_s_SparseMatrix___init;
2629 static PyObject *__pyx_n_s_SparseMatrix_fwrite;
2630 static PyObject *__pyx_n_s_SparseMatrix_getCSRrepresentatio;
2631 static PyObject *__pyx_n_s_SparseMatrix_getSubMatCSRreprese;
2632 static PyObject *__pyx_n_s_SparseMatrix_matvec;
2633 static PyObject *__pyx_n_s_TypeError;
2634 static PyObject *__pyx_kp_s_Unable_to_convert_item_to_object;
2635 static PyObject *__pyx_n_s_ValueError;
2636 static PyObject *__pyx_n_s_View_MemoryView;
2637 static PyObject *__pyx_n_s_allocate_buffer;
2638 static PyObject *__pyx_n_s_base;
2639 static PyObject *__pyx_n_s_c;
2640 static PyObject *__pyx_n_u_c;
2641 static PyObject *__pyx_n_s_cSparseMatrix;
2642 static PyObject *__pyx_n_s_cSparseMatrix_2;
2643 static PyObject *__pyx_n_s_class;
2644 static PyObject *__pyx_n_s_cline_in_traceback;
2645 static PyObject *__pyx_n_s_colind;
2646 static PyObject *__pyx_kp_s_contiguous_and_direct;
2647 static PyObject *__pyx_kp_s_contiguous_and_indirect;
2648 static PyObject *__pyx_kp_s_d_d_13_8e;
2649 static PyObject *__pyx_n_s_dict;
2650 static PyObject *__pyx_n_s_dim;
2651 static PyObject *__pyx_n_s_doc;
2652 static PyObject *__pyx_n_s_dtype_is_object;
2653 static PyObject *__pyx_n_s_encode;
2654 static PyObject *__pyx_n_s_enter;
2655 static PyObject *__pyx_n_s_enumerate;
2656 static PyObject *__pyx_n_s_error;
2657 static PyObject *__pyx_n_s_exit;
2658 static PyObject *__pyx_n_s_filename;
2659 static PyObject *__pyx_n_s_flags;
2660 static PyObject *__pyx_n_s_format;
2661 static PyObject *__pyx_n_s_fortran;
2662 static PyObject *__pyx_n_u_fortran;
2663 static PyObject *__pyx_n_s_fwrite;
2664 static PyObject *__pyx_n_s_getCSRrepresentation;
2665 static PyObject *__pyx_n_s_getSubMatCSRrepresentation;
2666 static PyObject *__pyx_n_s_getstate;
2667 static PyObject *__pyx_kp_s_got_differing_extents_in_dimensi;
2668 static PyObject *__pyx_n_s_i;
2669 static PyObject *__pyx_kp_s_i_i_i;
2670 static PyObject *__pyx_n_s_id;
2671 static PyObject *__pyx_n_s_import;
2672 static PyObject *__pyx_n_s_init;
2673 static PyObject *__pyx_n_s_itemsize;
2674 static PyObject *__pyx_kp_s_itemsize_0_for_cython_array;
2675 static PyObject *__pyx_n_s_k;
2676 static PyObject *__pyx_n_s_main;
2677 static PyObject *__pyx_n_s_matvec;
2678 static PyObject *__pyx_n_s_memview;
2679 static PyObject *__pyx_n_s_metaclass;
2680 static PyObject *__pyx_n_s_mode;
2681 static PyObject *__pyx_n_s_module;
2682 static PyObject *__pyx_n_s_name;
2683 static PyObject *__pyx_n_s_name_2;
2684 static PyObject *__pyx_n_s_nc;
2685 static PyObject *__pyx_n_s_ndim;
2686 static PyObject *__pyx_n_s_new;
2687 static PyObject *__pyx_n_s_nnz;
2688 static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
2689 static PyObject *__pyx_n_s_np;
2690 static PyObject *__pyx_n_s_nr;
2691 static PyObject *__pyx_n_s_numpy;
2692 static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to;
2693 static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor;
2694 static PyObject *__pyx_n_s_nzval;
2695 static PyObject *__pyx_n_s_nzvals;
2696 static PyObject *__pyx_n_s_obj;
2697 static PyObject *__pyx_n_s_object;
2698 static PyObject *__pyx_n_s_open;
2699 static PyObject *__pyx_n_s_output_file;
2700 static PyObject *__pyx_n_s_pack;
2701 static PyObject *__pyx_n_s_pickle;
2702 static PyObject *__pyx_n_s_prepare;
2703 static PyObject *__pyx_kp_s_proteus_superluWrappers_pyx;
2704 static PyObject *__pyx_n_s_pyx_PickleError;
2705 static PyObject *__pyx_n_s_pyx_checksum;
2706 static PyObject *__pyx_n_s_pyx_getbuffer;
2707 static PyObject *__pyx_n_s_pyx_result;
2708 static PyObject *__pyx_n_s_pyx_state;
2709 static PyObject *__pyx_n_s_pyx_type;
2710 static PyObject *__pyx_n_s_pyx_unpickle_Enum;
2711 static PyObject *__pyx_n_s_pyx_vtable;
2712 static PyObject *__pyx_n_s_qualname;
2713 static PyObject *__pyx_n_s_range;
2714 static PyObject *__pyx_n_s_range_end;
2715 static PyObject *__pyx_n_s_range_start;
2716 static PyObject *__pyx_n_s_reduce;
2717 static PyObject *__pyx_n_s_reduce_cython;
2718 static PyObject *__pyx_n_s_reduce_ex;
2719 static PyObject *__pyx_n_s_rowptr;
2720 static PyObject *__pyx_n_s_rows;
2721 static PyObject *__pyx_n_s_self;
2722 static PyObject *__pyx_kp_s_self_A_self_AC_self_L_self_U_sel;
2723 static PyObject *__pyx_n_s_setstate;
2724 static PyObject *__pyx_n_s_setstate_cython;
2725 static PyObject *__pyx_n_s_shape;
2726 static PyObject *__pyx_n_s_size;
2727 static PyObject *__pyx_n_s_sparseFactor;
2728 static PyObject *__pyx_n_s_sparseFactorPrepare;
2729 static PyObject *__pyx_n_s_sparseFactorSolve;
2730 static PyObject *__pyx_n_s_sparse_matrix;
2731 static PyObject *__pyx_n_s_start;
2732 static PyObject *__pyx_n_s_step;
2733 static PyObject *__pyx_n_s_stop;
2734 static PyObject *__pyx_kp_s_strided_and_direct;
2735 static PyObject *__pyx_kp_s_strided_and_direct_or_indirect;
2736 static PyObject *__pyx_kp_s_strided_and_indirect;
2737 static PyObject *__pyx_kp_s_stringsource;
2738 static PyObject *__pyx_n_s_struct;
2739 static PyObject *__pyx_n_s_superluWrappers;
2740 static PyObject *__pyx_n_s_test;
2741 static PyObject *__pyx_kp_s_unable_to_allocate_array_data;
2742 static PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str;
2743 static PyObject *__pyx_n_s_unpack;
2744 static PyObject *__pyx_n_s_update;
2745 static PyObject *__pyx_n_s_w;
2746 static PyObject *__pyx_n_s_write;
2747 static PyObject *__pyx_n_s_x;
2748 static PyObject *__pyx_n_s_y;
2749 static PyObject *__pyx_pf_15superluWrappers_12SparseMatrix___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_nr, PyObject *__pyx_v_nc, PyObject *__pyx_v_nnz, PyObject *__pyx_v_nzvals, PyObject *__pyx_v_colind, PyObject *__pyx_v_rowptr);
2750 static PyObject *__pyx_pf_15superluWrappers_12SparseMatrix_2matvec(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y);
2751 static PyObject *__pyx_pf_15superluWrappers_12SparseMatrix_4fwrite(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_base);
2752 static PyObject *__pyx_pf_15superluWrappers_12SparseMatrix_6getCSRrepresentation(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self);
2753 static PyObject *__pyx_pf_15superluWrappers_12SparseMatrix_8getSubMatCSRrepresentation(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_range_start, PyObject *__pyx_v_range_end);
2754 static int __pyx_pf_15superluWrappers_13cSparseMatrix___cinit__(
struct __pyx_obj_15superluWrappers_cSparseMatrix *__pyx_v_self,
int __pyx_v_nr,
int __pyx_v_nc,
int __pyx_v_nnz, __Pyx_memviewslice __pyx_v_nzval, __Pyx_memviewslice __pyx_v_colind, __Pyx_memviewslice __pyx_v_rowptr);
2755 static PyObject *__pyx_pf_15superluWrappers_13cSparseMatrix_2__reduce_cython__(CYTHON_UNUSED
struct __pyx_obj_15superluWrappers_cSparseMatrix *__pyx_v_self);
2756 static PyObject *__pyx_pf_15superluWrappers_13cSparseMatrix_4__setstate_cython__(CYTHON_UNUSED
struct __pyx_obj_15superluWrappers_cSparseMatrix *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state);
2757 static int __pyx_pf_15superluWrappers_12SparseFactor___init__(
struct __pyx_obj_15superluWrappers_SparseFactor *__pyx_v_self, PyObject *__pyx_v_dim);
2758 static PyObject *__pyx_pf_15superluWrappers_12SparseFactor_3dim___get__(
struct __pyx_obj_15superluWrappers_SparseFactor *__pyx_v_self);
2759 static int __pyx_pf_15superluWrappers_12SparseFactor_3dim_2__set__(
struct __pyx_obj_15superluWrappers_SparseFactor *__pyx_v_self, PyObject *__pyx_v_value);
2760 static PyObject *__pyx_pf_15superluWrappers_12SparseFactor_2__reduce_cython__(CYTHON_UNUSED
struct __pyx_obj_15superluWrappers_SparseFactor *__pyx_v_self);
2761 static PyObject *__pyx_pf_15superluWrappers_12SparseFactor_4__setstate_cython__(CYTHON_UNUSED
struct __pyx_obj_15superluWrappers_SparseFactor *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state);
2762 static PyObject *__pyx_pf_15superluWrappers_sparseFactorPrepare(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sparse_matrix, PyObject *__pyx_v_sparseFactor);
2763 static PyObject *__pyx_pf_15superluWrappers_2sparseFactorSolve(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sparseFactor, PyObject *__pyx_v_x);
2764 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode,
int __pyx_v_allocate_buffer);
2765 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(
struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
2766 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(
struct __pyx_array_obj *__pyx_v_self);
2767 static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(
struct __pyx_array_obj *__pyx_v_self);
2768 static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(
struct __pyx_array_obj *__pyx_v_self);
2769 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr);
2770 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item);
2771 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value);
2772 static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED
struct __pyx_array_obj *__pyx_v_self);
2773 static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state);
2774 static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(
struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name);
2775 static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(
struct __pyx_MemviewEnum_obj *__pyx_v_self);
2776 static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(
struct __pyx_MemviewEnum_obj *__pyx_v_self);
2777 static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(
struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state);
2778 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj,
int __pyx_v_flags,
int __pyx_v_dtype_is_object);
2779 static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(
struct __pyx_memoryview_obj *__pyx_v_self);
2780 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index);
2781 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value);
2782 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(
struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
2783 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2784 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2785 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2786 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2787 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2788 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2789 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2790 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2791 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2792 static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(
struct __pyx_memoryview_obj *__pyx_v_self);
2793 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(
struct __pyx_memoryview_obj *__pyx_v_self);
2794 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(
struct __pyx_memoryview_obj *__pyx_v_self);
2795 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(
struct __pyx_memoryview_obj *__pyx_v_self);
2796 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(
struct __pyx_memoryview_obj *__pyx_v_self);
2797 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(
struct __pyx_memoryview_obj *__pyx_v_self);
2798 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(
struct __pyx_memoryview_obj *__pyx_v_self);
2799 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED
struct __pyx_memoryview_obj *__pyx_v_self);
2800 static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state);
2801 static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(
struct __pyx_memoryviewslice_obj *__pyx_v_self);
2802 static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(
struct __pyx_memoryviewslice_obj *__pyx_v_self);
2803 static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED
struct __pyx_memoryviewslice_obj *__pyx_v_self);
2804 static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state);
2805 static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type,
long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state);
2806 static PyObject *__pyx_tp_new_15superluWrappers_cSparseMatrix(PyTypeObject *t, PyObject *a, PyObject *k);
2807 static PyObject *__pyx_tp_new_15superluWrappers_SparseFactor(PyTypeObject *t, PyObject *a, PyObject *k);
2808 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k);
2809 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k);
2810 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k);
2811 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k);
2812 static PyObject *__pyx_int_0;
2813 static PyObject *__pyx_int_1;
2814 static PyObject *__pyx_int_184977713;
2815 static PyObject *__pyx_int_neg_1;
2816 static PyObject *__pyx_tuple_;
2817 static PyObject *__pyx_tuple__2;
2818 static PyObject *__pyx_tuple__3;
2819 static PyObject *__pyx_tuple__4;
2820 static PyObject *__pyx_tuple__5;
2821 static PyObject *__pyx_tuple__6;
2822 static PyObject *__pyx_tuple__7;
2823 static PyObject *__pyx_tuple__8;
2824 static PyObject *__pyx_tuple__9;
2825 static PyObject *__pyx_slice__22;
2826 static PyObject *__pyx_tuple__10;
2827 static PyObject *__pyx_tuple__11;
2828 static PyObject *__pyx_tuple__12;
2829 static PyObject *__pyx_tuple__13;
2830 static PyObject *__pyx_tuple__14;
2831 static PyObject *__pyx_tuple__15;
2832 static PyObject *__pyx_tuple__16;
2833 static PyObject *__pyx_tuple__17;
2834 static PyObject *__pyx_tuple__18;
2835 static PyObject *__pyx_tuple__19;
2836 static PyObject *__pyx_tuple__20;
2837 static PyObject *__pyx_tuple__21;
2838 static PyObject *__pyx_tuple__23;
2839 static PyObject *__pyx_tuple__24;
2840 static PyObject *__pyx_tuple__25;
2841 static PyObject *__pyx_tuple__26;
2842 static PyObject *__pyx_tuple__27;
2843 static PyObject *__pyx_tuple__29;
2844 static PyObject *__pyx_tuple__31;
2845 static PyObject *__pyx_tuple__33;
2846 static PyObject *__pyx_tuple__35;
2847 static PyObject *__pyx_tuple__37;
2848 static PyObject *__pyx_tuple__39;
2849 static PyObject *__pyx_tuple__41;
2850 static PyObject *__pyx_tuple__42;
2851 static PyObject *__pyx_tuple__43;
2852 static PyObject *__pyx_tuple__44;
2853 static PyObject *__pyx_tuple__45;
2854 static PyObject *__pyx_tuple__46;
2855 static PyObject *__pyx_codeobj__28;
2856 static PyObject *__pyx_codeobj__30;
2857 static PyObject *__pyx_codeobj__32;
2858 static PyObject *__pyx_codeobj__34;
2859 static PyObject *__pyx_codeobj__36;
2860 static PyObject *__pyx_codeobj__38;
2861 static PyObject *__pyx_codeobj__40;
2862 static PyObject *__pyx_codeobj__47;
2874 static PyObject *__pyx_pw_15superluWrappers_12SparseMatrix_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
2875 static PyMethodDef __pyx_mdef_15superluWrappers_12SparseMatrix_1__init__ = {
"__init__", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_15superluWrappers_12SparseMatrix_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
2876 static PyObject *__pyx_pw_15superluWrappers_12SparseMatrix_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2877 PyObject *__pyx_v_self = 0;
2878 PyObject *__pyx_v_nr = 0;
2879 PyObject *__pyx_v_nc = 0;
2880 PyObject *__pyx_v_nnz = 0;
2881 PyObject *__pyx_v_nzvals = 0;
2882 PyObject *__pyx_v_colind = 0;
2883 PyObject *__pyx_v_rowptr = 0;
2884 int __pyx_lineno = 0;
2885 const char *__pyx_filename = NULL;
2886 int __pyx_clineno = 0;
2887 PyObject *__pyx_r = 0;
2888 __Pyx_RefNannyDeclarations
2889 __Pyx_RefNannySetupContext(
"__init__ (wrapper)", 0);
2891 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_nr,&__pyx_n_s_nc,&__pyx_n_s_nnz,&__pyx_n_s_nzvals,&__pyx_n_s_colind,&__pyx_n_s_rowptr,0};
2892 PyObject* values[7] = {0,0,0,0,0,0,0};
2893 if (unlikely(__pyx_kwds)) {
2895 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2897 case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
2899 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
2901 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2903 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2905 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2907 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2909 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2912 default:
goto __pyx_L5_argtuple_error;
2914 kw_args = PyDict_Size(__pyx_kwds);
2917 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
2918 else goto __pyx_L5_argtuple_error;
2921 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nr)) != 0)) kw_args--;
2923 __Pyx_RaiseArgtupleInvalid(
"__init__", 1, 7, 7, 1); __PYX_ERR(0, 15, __pyx_L3_error)
2927 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nc)) != 0)) kw_args--;
2929 __Pyx_RaiseArgtupleInvalid(
"__init__", 1, 7, 7, 2); __PYX_ERR(0, 15, __pyx_L3_error)
2933 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nnz)) != 0)) kw_args--;
2935 __Pyx_RaiseArgtupleInvalid(
"__init__", 1, 7, 7, 3); __PYX_ERR(0, 15, __pyx_L3_error)
2939 if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nzvals)) != 0)) kw_args--;
2941 __Pyx_RaiseArgtupleInvalid(
"__init__", 1, 7, 7, 4); __PYX_ERR(0, 15, __pyx_L3_error)
2945 if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_colind)) != 0)) kw_args--;
2947 __Pyx_RaiseArgtupleInvalid(
"__init__", 1, 7, 7, 5); __PYX_ERR(0, 15, __pyx_L3_error)
2951 if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rowptr)) != 0)) kw_args--;
2953 __Pyx_RaiseArgtupleInvalid(
"__init__", 1, 7, 7, 6); __PYX_ERR(0, 15, __pyx_L3_error)
2956 if (unlikely(kw_args > 0)) {
2957 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__init__") < 0)) __PYX_ERR(0, 15, __pyx_L3_error)
2959 }
else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
2960 goto __pyx_L5_argtuple_error;
2962 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2963 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2964 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2965 values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2966 values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2967 values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
2968 values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
2970 __pyx_v_self = values[0];
2971 __pyx_v_nr = values[1];
2972 __pyx_v_nc = values[2];
2973 __pyx_v_nnz = values[3];
2974 __pyx_v_nzvals = values[4];
2975 __pyx_v_colind = values[5];
2976 __pyx_v_rowptr = values[6];
2978 goto __pyx_L4_argument_unpacking_done;
2979 __pyx_L5_argtuple_error:;
2980 __Pyx_RaiseArgtupleInvalid(
"__init__", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 15, __pyx_L3_error)
2982 __Pyx_AddTraceback(
"superluWrappers.SparseMatrix.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2983 __Pyx_RefNannyFinishContext();
2985 __pyx_L4_argument_unpacking_done:;
2986 __pyx_r = __pyx_pf_15superluWrappers_12SparseMatrix___init__(__pyx_self, __pyx_v_self, __pyx_v_nr, __pyx_v_nc, __pyx_v_nnz, __pyx_v_nzvals, __pyx_v_colind, __pyx_v_rowptr);
2989 __Pyx_RefNannyFinishContext();
2993 static PyObject *__pyx_pf_15superluWrappers_12SparseMatrix___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_nr, PyObject *__pyx_v_nc, PyObject *__pyx_v_nnz, PyObject *__pyx_v_nzvals, PyObject *__pyx_v_colind, PyObject *__pyx_v_rowptr) {
2994 PyObject *__pyx_r = NULL;
2995 __Pyx_RefNannyDeclarations
2996 PyObject *__pyx_t_1 = NULL;
2997 PyObject *__pyx_t_2 = NULL;
2998 PyObject *__pyx_t_3 = NULL;
2999 PyObject *__pyx_t_4 = NULL;
3000 int __pyx_lineno = 0;
3001 const char *__pyx_filename = NULL;
3002 int __pyx_clineno = 0;
3003 __Pyx_RefNannySetupContext(
"__init__", 0);
3012 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_nr, __pyx_v_nr) < 0) __PYX_ERR(0, 22, __pyx_L1_error)
3013 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_nc, __pyx_v_nc) < 0) __PYX_ERR(0, 22, __pyx_L1_error)
3022 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_nnz, __pyx_v_nnz) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
3031 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nr);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error)
3032 __Pyx_GOTREF(__pyx_t_1);
3033 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nc);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error)
3034 __Pyx_GOTREF(__pyx_t_2);
3035 __pyx_t_3 = PyList_New(2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 24, __pyx_L1_error)
3036 __Pyx_GOTREF(__pyx_t_3);
3037 __Pyx_GIVEREF(__pyx_t_1);
3038 PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
3039 __Pyx_GIVEREF(__pyx_t_2);
3040 PyList_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
3043 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_shape, __pyx_t_3) < 0) __PYX_ERR(0, 24, __pyx_L1_error)
3044 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3053 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_nzvals, __pyx_v_nzvals) < 0) __PYX_ERR(0, 25, __pyx_L1_error)
3062 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_colind, __pyx_v_colind) < 0) __PYX_ERR(0, 26, __pyx_L1_error)
3071 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_rowptr, __pyx_v_rowptr) < 0) __PYX_ERR(0, 27, __pyx_L1_error)
3080 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nzvals);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 31, __pyx_L1_error)
3081 __Pyx_GOTREF(__pyx_t_3);
3090 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_colind);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 32, __pyx_L1_error)
3091 __Pyx_GOTREF(__pyx_t_2);
3100 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rowptr);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 33, __pyx_L1_error)
3101 __Pyx_GOTREF(__pyx_t_1);
3110 __pyx_t_4 = PyTuple_New(6);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 28, __pyx_L1_error)
3111 __Pyx_GOTREF(__pyx_t_4);
3112 __Pyx_INCREF(__pyx_v_nr);
3113 __Pyx_GIVEREF(__pyx_v_nr);
3114 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_nr);
3115 __Pyx_INCREF(__pyx_v_nc);
3116 __Pyx_GIVEREF(__pyx_v_nc);
3117 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_nc);
3118 __Pyx_INCREF(__pyx_v_nnz);
3119 __Pyx_GIVEREF(__pyx_v_nnz);
3120 PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_nnz);
3121 __Pyx_GIVEREF(__pyx_t_3);
3122 PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_3);
3123 __Pyx_GIVEREF(__pyx_t_2);
3124 PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_t_2);
3125 __Pyx_GIVEREF(__pyx_t_1);
3126 PyTuple_SET_ITEM(__pyx_t_4, 5, __pyx_t_1);
3130 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_15superluWrappers_cSparseMatrix), __pyx_t_4, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __pyx_L1_error)
3131 __Pyx_GOTREF(__pyx_t_1);
3132 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3133 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cSparseMatrix, __pyx_t_1) < 0) __PYX_ERR(0, 28, __pyx_L1_error)
3134 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3145 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3148 __Pyx_XDECREF(__pyx_t_1);
3149 __Pyx_XDECREF(__pyx_t_2);
3150 __Pyx_XDECREF(__pyx_t_3);
3151 __Pyx_XDECREF(__pyx_t_4);
3152 __Pyx_AddTraceback(
"superluWrappers.SparseMatrix.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3155 __Pyx_XGIVEREF(__pyx_r);
3156 __Pyx_RefNannyFinishContext();
3169 static PyObject *__pyx_pw_15superluWrappers_12SparseMatrix_3matvec(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
3170 static char __pyx_doc_15superluWrappers_12SparseMatrix_2matvec[] =
"\n Compute the sparse matrix-vector product y = Ax\n\n Arguments\n ---------\n x (input) : numpy array\n y (output) : numpy array\n ";
3171 static PyMethodDef __pyx_mdef_15superluWrappers_12SparseMatrix_3matvec = {
"matvec", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_15superluWrappers_12SparseMatrix_3matvec, METH_VARARGS|METH_KEYWORDS, __pyx_doc_15superluWrappers_12SparseMatrix_2matvec};
3172 static PyObject *__pyx_pw_15superluWrappers_12SparseMatrix_3matvec(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3173 PyObject *__pyx_v_self = 0;
3174 PyObject *__pyx_v_x = 0;
3175 PyObject *__pyx_v_y = 0;
3176 int __pyx_lineno = 0;
3177 const char *__pyx_filename = NULL;
3178 int __pyx_clineno = 0;
3179 PyObject *__pyx_r = 0;
3180 __Pyx_RefNannyDeclarations
3181 __Pyx_RefNannySetupContext(
"matvec (wrapper)", 0);
3183 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_x,&__pyx_n_s_y,0};
3184 PyObject* values[3] = {0,0,0};
3185 if (unlikely(__pyx_kwds)) {
3187 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3189 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3191 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3193 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3196 default:
goto __pyx_L5_argtuple_error;
3198 kw_args = PyDict_Size(__pyx_kwds);
3201 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
3202 else goto __pyx_L5_argtuple_error;
3205 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
3207 __Pyx_RaiseArgtupleInvalid(
"matvec", 1, 3, 3, 1); __PYX_ERR(0, 35, __pyx_L3_error)
3211 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
3213 __Pyx_RaiseArgtupleInvalid(
"matvec", 1, 3, 3, 2); __PYX_ERR(0, 35, __pyx_L3_error)
3216 if (unlikely(kw_args > 0)) {
3217 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"matvec") < 0)) __PYX_ERR(0, 35, __pyx_L3_error)
3219 }
else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
3220 goto __pyx_L5_argtuple_error;
3222 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3223 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3224 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3226 __pyx_v_self = values[0];
3227 __pyx_v_x = values[1];
3228 __pyx_v_y = values[2];
3230 goto __pyx_L4_argument_unpacking_done;
3231 __pyx_L5_argtuple_error:;
3232 __Pyx_RaiseArgtupleInvalid(
"matvec", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 35, __pyx_L3_error)
3234 __Pyx_AddTraceback(
"superluWrappers.SparseMatrix.matvec", __pyx_clineno, __pyx_lineno, __pyx_filename);
3235 __Pyx_RefNannyFinishContext();
3237 __pyx_L4_argument_unpacking_done:;
3238 __pyx_r = __pyx_pf_15superluWrappers_12SparseMatrix_2matvec(__pyx_self, __pyx_v_self, __pyx_v_x, __pyx_v_y);
3241 __Pyx_RefNannyFinishContext();
3245 static PyObject *__pyx_pf_15superluWrappers_12SparseMatrix_2matvec(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
3246 PyObject *__pyx_r = NULL;
3247 __Pyx_RefNannyDeclarations
3248 PyObject *__pyx_t_1 = NULL;
3249 __Pyx_memviewslice __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } };
3250 __Pyx_memviewslice __pyx_t_3 = { 0, 0, { 0 }, { 0 }, { 0 } };
3251 int __pyx_lineno = 0;
3252 const char *__pyx_filename = NULL;
3253 int __pyx_clineno = 0;
3254 __Pyx_RefNannySetupContext(
"matvec", 0);
3263 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cSparseMatrix);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error)
3264 __Pyx_GOTREF(__pyx_t_1);
3265 if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_15superluWrappers_cSparseMatrix))))) __PYX_ERR(0, 44, __pyx_L1_error)
3266 __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(__pyx_v_x, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 44, __pyx_L1_error)
3267 __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(__pyx_v_y, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 44, __pyx_L1_error)
3268 __pyx_f_15superluWrappers_SparseMatrix_matvec(((
struct __pyx_obj_15superluWrappers_cSparseMatrix *)__pyx_t_1), __pyx_t_2, __pyx_t_3);
3269 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3270 __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1);
3271 __pyx_t_2.memview = NULL;
3272 __pyx_t_2.data = NULL;
3273 __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
3274 __pyx_t_3.memview = NULL;
3275 __pyx_t_3.data = NULL;
3286 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3289 __Pyx_XDECREF(__pyx_t_1);
3290 __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1);
3291 __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
3292 __Pyx_AddTraceback(
"superluWrappers.SparseMatrix.matvec", __pyx_clineno, __pyx_lineno, __pyx_filename);
3295 __Pyx_XGIVEREF(__pyx_r);
3296 __Pyx_RefNannyFinishContext();
3309 static PyObject *__pyx_pw_15superluWrappers_12SparseMatrix_5fwrite(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
3310 static char __pyx_doc_15superluWrappers_12SparseMatrix_4fwrite[] =
" Write the sparse matrix to a file\n\n Arguments\n ---------\n filename : str\n The output filename\n base : int\n ?!Possibly something to do with parallel?!\n ";
3311 static PyMethodDef __pyx_mdef_15superluWrappers_12SparseMatrix_5fwrite = {
"fwrite", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_15superluWrappers_12SparseMatrix_5fwrite, METH_VARARGS|METH_KEYWORDS, __pyx_doc_15superluWrappers_12SparseMatrix_4fwrite};
3312 static PyObject *__pyx_pw_15superluWrappers_12SparseMatrix_5fwrite(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3313 PyObject *__pyx_v_self = 0;
3314 PyObject *__pyx_v_filename = 0;
3315 PyObject *__pyx_v_base = 0;
3316 int __pyx_lineno = 0;
3317 const char *__pyx_filename = NULL;
3318 int __pyx_clineno = 0;
3319 PyObject *__pyx_r = 0;
3320 __Pyx_RefNannyDeclarations
3321 __Pyx_RefNannySetupContext(
"fwrite (wrapper)", 0);
3323 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_filename,&__pyx_n_s_base,0};
3324 PyObject* values[3] = {0,0,0};
3325 if (unlikely(__pyx_kwds)) {
3327 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3329 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3331 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3333 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3336 default:
goto __pyx_L5_argtuple_error;
3338 kw_args = PyDict_Size(__pyx_kwds);
3341 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
3342 else goto __pyx_L5_argtuple_error;
3345 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
3347 __Pyx_RaiseArgtupleInvalid(
"fwrite", 1, 3, 3, 1); __PYX_ERR(0, 46, __pyx_L3_error)
3351 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_base)) != 0)) kw_args--;
3353 __Pyx_RaiseArgtupleInvalid(
"fwrite", 1, 3, 3, 2); __PYX_ERR(0, 46, __pyx_L3_error)
3356 if (unlikely(kw_args > 0)) {
3357 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"fwrite") < 0)) __PYX_ERR(0, 46, __pyx_L3_error)
3359 }
else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
3360 goto __pyx_L5_argtuple_error;
3362 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3363 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3364 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3366 __pyx_v_self = values[0];
3367 __pyx_v_filename = values[1];
3368 __pyx_v_base = values[2];
3370 goto __pyx_L4_argument_unpacking_done;
3371 __pyx_L5_argtuple_error:;
3372 __Pyx_RaiseArgtupleInvalid(
"fwrite", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 46, __pyx_L3_error)
3374 __Pyx_AddTraceback(
"superluWrappers.SparseMatrix.fwrite", __pyx_clineno, __pyx_lineno, __pyx_filename);
3375 __Pyx_RefNannyFinishContext();
3377 __pyx_L4_argument_unpacking_done:;
3378 __pyx_r = __pyx_pf_15superluWrappers_12SparseMatrix_4fwrite(__pyx_self, __pyx_v_self, __pyx_v_filename, __pyx_v_base);
3381 __Pyx_RefNannyFinishContext();
3385 static PyObject *__pyx_pf_15superluWrappers_12SparseMatrix_4fwrite(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_base) {
3386 PyObject *__pyx_v_output_file = NULL;
3387 PyObject *__pyx_v_i = NULL;
3388 PyObject *__pyx_v_k = NULL;
3389 PyObject *__pyx_r = NULL;
3390 __Pyx_RefNannyDeclarations
3391 PyObject *__pyx_t_1 = NULL;
3392 PyObject *__pyx_t_2 = NULL;
3393 PyObject *__pyx_t_3 = NULL;
3394 PyObject *__pyx_t_4 = NULL;
3395 PyObject *__pyx_t_5 = NULL;
3396 PyObject *__pyx_t_6 = NULL;
3397 PyObject *__pyx_t_7 = NULL;
3398 PyObject *__pyx_t_8 = NULL;
3399 PyObject *__pyx_t_9 = NULL;
3400 PyObject *__pyx_t_10 = NULL;
3401 PyObject *__pyx_t_11 = NULL;
3402 Py_ssize_t __pyx_t_12;
3403 PyObject *(*__pyx_t_13)(PyObject *);
3404 Py_ssize_t __pyx_t_14;
3405 PyObject *(*__pyx_t_15)(PyObject *);
3406 PyObject *__pyx_t_16 = NULL;
3407 PyObject *__pyx_t_17 = NULL;
3410 int __pyx_lineno = 0;
3411 const char *__pyx_filename = NULL;
3412 int __pyx_clineno = 0;
3413 __Pyx_RefNannySetupContext(
"fwrite", 0);
3423 __pyx_t_1 = PyTuple_New(2);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error)
3424 __Pyx_GOTREF(__pyx_t_1);
3425 __Pyx_INCREF(__pyx_v_filename);
3426 __Pyx_GIVEREF(__pyx_v_filename);
3427 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_filename);
3428 __Pyx_INCREF(__pyx_n_s_w);
3429 __Pyx_GIVEREF(__pyx_n_s_w);
3430 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_w);
3431 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_1, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error)
3432 __Pyx_GOTREF(__pyx_t_2);
3433 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3434 __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_n_s_exit);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 56, __pyx_L1_error)
3435 __Pyx_GOTREF(__pyx_t_3);
3436 __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_n_s_enter);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 56, __pyx_L3_error)
3437 __Pyx_GOTREF(__pyx_t_4);
3439 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
3440 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
3441 if (likely(__pyx_t_5)) {
3442 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_4);
3443 __Pyx_INCREF(__pyx_t_5);
3444 __Pyx_INCREF(
function);
3445 __Pyx_DECREF_SET(__pyx_t_4,
function);
3448 __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
3449 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
3450 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L3_error)
3451 __Pyx_GOTREF(__pyx_t_1);
3452 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3453 __pyx_t_4 = __pyx_t_1;
3455 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3458 __Pyx_PyThreadState_declare
3459 __Pyx_PyThreadState_assign
3460 __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
3461 __Pyx_XGOTREF(__pyx_t_6);
3462 __Pyx_XGOTREF(__pyx_t_7);
3463 __Pyx_XGOTREF(__pyx_t_8);
3465 __pyx_v_output_file = __pyx_t_4;
3475 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_output_file, __pyx_n_s_write);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 57, __pyx_L7_error)
3476 __Pyx_GOTREF(__pyx_t_2);
3477 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nr);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 57, __pyx_L7_error)
3478 __Pyx_GOTREF(__pyx_t_1);
3479 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nc);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 57, __pyx_L7_error)
3480 __Pyx_GOTREF(__pyx_t_5);
3481 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rowptr);
if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 57, __pyx_L7_error)
3482 __Pyx_GOTREF(__pyx_t_9);
3483 __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nr);
if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 57, __pyx_L7_error)
3484 __Pyx_GOTREF(__pyx_t_10);
3485 __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_t_9, __pyx_t_10);
if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 57, __pyx_L7_error)
3486 __Pyx_GOTREF(__pyx_t_11);
3487 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3488 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3489 __pyx_t_10 = PyTuple_New(3);
if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 57, __pyx_L7_error)
3490 __Pyx_GOTREF(__pyx_t_10);
3491 __Pyx_GIVEREF(__pyx_t_1);
3492 PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1);
3493 __Pyx_GIVEREF(__pyx_t_5);
3494 PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_5);
3495 __Pyx_GIVEREF(__pyx_t_11);
3496 PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_11);
3500 __pyx_t_11 = __Pyx_PyString_Format(__pyx_kp_s_i_i_i, __pyx_t_10);
if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 57, __pyx_L7_error)
3501 __Pyx_GOTREF(__pyx_t_11);
3502 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3504 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
3505 __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_2);
3506 if (likely(__pyx_t_10)) {
3507 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_2);
3508 __Pyx_INCREF(__pyx_t_10);
3509 __Pyx_INCREF(
function);
3510 __Pyx_DECREF_SET(__pyx_t_2,
function);
3513 __pyx_t_4 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_10, __pyx_t_11) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_11);
3514 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
3515 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3516 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 57, __pyx_L7_error)
3517 __Pyx_GOTREF(__pyx_t_4);
3518 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3519 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3528 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nr);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 58, __pyx_L7_error)
3529 __Pyx_GOTREF(__pyx_t_4);
3530 __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_4);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 58, __pyx_L7_error)
3531 __Pyx_GOTREF(__pyx_t_2);
3532 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3533 if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
3534 __pyx_t_4 = __pyx_t_2; __Pyx_INCREF(__pyx_t_4); __pyx_t_12 = 0;
3537 __pyx_t_12 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_2);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 58, __pyx_L7_error)
3538 __Pyx_GOTREF(__pyx_t_4);
3539 __pyx_t_13 = Py_TYPE(__pyx_t_4)->tp_iternext;
if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 58, __pyx_L7_error)
3541 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3543 if (likely(!__pyx_t_13)) {
3544 if (likely(PyList_CheckExact(__pyx_t_4))) {
3545 if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_4))
break;
3546 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3547 __pyx_t_2 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_12); __Pyx_INCREF(__pyx_t_2); __pyx_t_12++;
if (unlikely(0 < 0)) __PYX_ERR(0, 58, __pyx_L7_error)
3549 __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_12); __pyx_t_12++;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 58, __pyx_L7_error)
3550 __Pyx_GOTREF(__pyx_t_2);
3553 if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_4))
break;
3554 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3555 __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_12); __Pyx_INCREF(__pyx_t_2); __pyx_t_12++;
if (unlikely(0 < 0)) __PYX_ERR(0, 58, __pyx_L7_error)
3557 __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_12); __pyx_t_12++;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 58, __pyx_L7_error)
3558 __Pyx_GOTREF(__pyx_t_2);
3562 __pyx_t_2 = __pyx_t_13(__pyx_t_4);
3563 if (unlikely(!__pyx_t_2)) {
3564 PyObject* exc_type = PyErr_Occurred();
3566 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
3567 else __PYX_ERR(0, 58, __pyx_L7_error)
3571 __Pyx_GOTREF(__pyx_t_2);
3573 __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2);
3583 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rowptr);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 59, __pyx_L7_error)
3584 __Pyx_GOTREF(__pyx_t_2);
3585 __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_v_i);
if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 59, __pyx_L7_error)
3586 __Pyx_GOTREF(__pyx_t_11);
3587 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3588 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rowptr);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 59, __pyx_L7_error)
3589 __Pyx_GOTREF(__pyx_t_2);
3590 __pyx_t_10 = __Pyx_PyInt_AddObjC(__pyx_v_i, __pyx_int_1, 1, 0, 0);
if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 59, __pyx_L7_error)
3591 __Pyx_GOTREF(__pyx_t_10);
3592 __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_t_10);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 59, __pyx_L7_error)
3593 __Pyx_GOTREF(__pyx_t_5);
3594 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3595 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3596 __pyx_t_10 = PyTuple_New(2);
if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 59, __pyx_L7_error)
3597 __Pyx_GOTREF(__pyx_t_10);
3598 __Pyx_GIVEREF(__pyx_t_11);
3599 PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_11);
3600 __Pyx_GIVEREF(__pyx_t_5);
3601 PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_5);
3604 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_10, NULL);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 59, __pyx_L7_error)
3605 __Pyx_GOTREF(__pyx_t_5);
3606 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3607 if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) {
3608 __pyx_t_10 = __pyx_t_5; __Pyx_INCREF(__pyx_t_10); __pyx_t_14 = 0;
3611 __pyx_t_14 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_5);
if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 59, __pyx_L7_error)
3612 __Pyx_GOTREF(__pyx_t_10);
3613 __pyx_t_15 = Py_TYPE(__pyx_t_10)->tp_iternext;
if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 59, __pyx_L7_error)
3615 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3617 if (likely(!__pyx_t_15)) {
3618 if (likely(PyList_CheckExact(__pyx_t_10))) {
3619 if (__pyx_t_14 >= PyList_GET_SIZE(__pyx_t_10))
break;
3620 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3621 __pyx_t_5 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_14); __Pyx_INCREF(__pyx_t_5); __pyx_t_14++;
if (unlikely(0 < 0)) __PYX_ERR(0, 59, __pyx_L7_error)
3623 __pyx_t_5 = PySequence_ITEM(__pyx_t_10, __pyx_t_14); __pyx_t_14++;
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 59, __pyx_L7_error)
3624 __Pyx_GOTREF(__pyx_t_5);
3627 if (__pyx_t_14 >= PyTuple_GET_SIZE(__pyx_t_10))
break;
3628 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3629 __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_14); __Pyx_INCREF(__pyx_t_5); __pyx_t_14++;
if (unlikely(0 < 0)) __PYX_ERR(0, 59, __pyx_L7_error)
3631 __pyx_t_5 = PySequence_ITEM(__pyx_t_10, __pyx_t_14); __pyx_t_14++;
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 59, __pyx_L7_error)
3632 __Pyx_GOTREF(__pyx_t_5);
3636 __pyx_t_5 = __pyx_t_15(__pyx_t_10);
3637 if (unlikely(!__pyx_t_5)) {
3638 PyObject* exc_type = PyErr_Occurred();
3640 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
3641 else __PYX_ERR(0, 59, __pyx_L7_error)
3645 __Pyx_GOTREF(__pyx_t_5);
3647 __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_5);
3657 __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_output_file, __pyx_n_s_write);
if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 60, __pyx_L7_error)
3658 __Pyx_GOTREF(__pyx_t_11);
3659 __pyx_t_2 = PyNumber_Add(__pyx_v_i, __pyx_v_base);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 60, __pyx_L7_error)
3660 __Pyx_GOTREF(__pyx_t_2);
3661 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_colind);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L7_error)
3662 __Pyx_GOTREF(__pyx_t_1);
3663 __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_k);
if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 60, __pyx_L7_error)
3664 __Pyx_GOTREF(__pyx_t_9);
3665 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3666 __pyx_t_1 = PyNumber_Add(__pyx_t_9, __pyx_v_base);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L7_error)
3667 __Pyx_GOTREF(__pyx_t_1);
3668 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3669 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nzvals);
if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 60, __pyx_L7_error)
3670 __Pyx_GOTREF(__pyx_t_9);
3671 __pyx_t_16 = __Pyx_PyObject_GetItem(__pyx_t_9, __pyx_v_k);
if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 60, __pyx_L7_error)
3672 __Pyx_GOTREF(__pyx_t_16);
3673 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3674 __pyx_t_9 = PyTuple_New(3);
if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 60, __pyx_L7_error)
3675 __Pyx_GOTREF(__pyx_t_9);
3676 __Pyx_GIVEREF(__pyx_t_2);
3677 PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
3678 __Pyx_GIVEREF(__pyx_t_1);
3679 PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_1);
3680 __Pyx_GIVEREF(__pyx_t_16);
3681 PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_16);
3685 __pyx_t_16 = __Pyx_PyString_Format(__pyx_kp_s_d_d_13_8e, __pyx_t_9);
if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 60, __pyx_L7_error)
3686 __Pyx_GOTREF(__pyx_t_16);
3687 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3689 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
3690 __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_11);
3691 if (likely(__pyx_t_9)) {
3692 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_11);
3693 __Pyx_INCREF(__pyx_t_9);
3694 __Pyx_INCREF(
function);
3695 __Pyx_DECREF_SET(__pyx_t_11,
function);
3698 __pyx_t_5 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_9, __pyx_t_16) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_16);
3699 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
3700 __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
3701 if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 60, __pyx_L7_error)
3702 __Pyx_GOTREF(__pyx_t_5);
3703 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3704 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3714 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3724 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3734 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
3735 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
3736 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
3737 goto __pyx_L12_try_end;
3739 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
3740 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
3741 __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
3742 __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
3743 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
3744 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
3745 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
3746 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
3748 __Pyx_AddTraceback(
"superluWrappers.SparseMatrix.fwrite", __pyx_clineno, __pyx_lineno, __pyx_filename);
3749 if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_10, &__pyx_t_5) < 0) __PYX_ERR(0, 56, __pyx_L9_except_error)
3750 __Pyx_GOTREF(__pyx_t_4);
3751 __Pyx_GOTREF(__pyx_t_10);
3752 __Pyx_GOTREF(__pyx_t_5);
3753 __pyx_t_11 = PyTuple_Pack(3, __pyx_t_4, __pyx_t_10, __pyx_t_5);
if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 56, __pyx_L9_except_error)
3754 __Pyx_GOTREF(__pyx_t_11);
3755 __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_11, NULL);
3756 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3757 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3758 if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 56, __pyx_L9_except_error)
3759 __Pyx_GOTREF(__pyx_t_17);
3760 __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_17);
3761 __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
3762 if (__pyx_t_18 < 0) __PYX_ERR(0, 56, __pyx_L9_except_error)
3763 __pyx_t_19 = ((!(__pyx_t_18 != 0)) != 0);
3765 __Pyx_GIVEREF(__pyx_t_4);
3766 __Pyx_GIVEREF(__pyx_t_10);
3767 __Pyx_XGIVEREF(__pyx_t_5);
3768 __Pyx_ErrRestoreWithState(__pyx_t_4, __pyx_t_10, __pyx_t_5);
3769 __pyx_t_4 = 0; __pyx_t_10 = 0; __pyx_t_5 = 0;
3770 __PYX_ERR(0, 56, __pyx_L9_except_error)
3772 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
3773 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
3774 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
3775 goto __pyx_L8_exception_handled;
3777 __pyx_L9_except_error:;
3778 __Pyx_XGIVEREF(__pyx_t_6);
3779 __Pyx_XGIVEREF(__pyx_t_7);
3780 __Pyx_XGIVEREF(__pyx_t_8);
3781 __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
3782 goto __pyx_L1_error;
3783 __pyx_L8_exception_handled:;
3784 __Pyx_XGIVEREF(__pyx_t_6);
3785 __Pyx_XGIVEREF(__pyx_t_7);
3786 __Pyx_XGIVEREF(__pyx_t_8);
3787 __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
3794 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple_, NULL);
3795 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3796 if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 56, __pyx_L1_error)
3797 __Pyx_GOTREF(__pyx_t_8);
3798 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3806 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3807 goto __pyx_L1_error;
3820 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3823 __Pyx_XDECREF(__pyx_t_1);
3824 __Pyx_XDECREF(__pyx_t_2);
3825 __Pyx_XDECREF(__pyx_t_4);
3826 __Pyx_XDECREF(__pyx_t_5);
3827 __Pyx_XDECREF(__pyx_t_9);
3828 __Pyx_XDECREF(__pyx_t_10);
3829 __Pyx_XDECREF(__pyx_t_11);
3830 __Pyx_XDECREF(__pyx_t_16);
3831 __Pyx_AddTraceback(
"superluWrappers.SparseMatrix.fwrite", __pyx_clineno, __pyx_lineno, __pyx_filename);
3834 __Pyx_XDECREF(__pyx_v_output_file);
3835 __Pyx_XDECREF(__pyx_v_i);
3836 __Pyx_XDECREF(__pyx_v_k);
3837 __Pyx_XGIVEREF(__pyx_r);
3838 __Pyx_RefNannyFinishContext();
3851 static PyObject *__pyx_pw_15superluWrappers_12SparseMatrix_7getCSRrepresentation(PyObject *__pyx_self, PyObject *__pyx_v_self);
3852 static char __pyx_doc_15superluWrappers_12SparseMatrix_6getCSRrepresentation[] =
" Get the CSR representation of the sparse matrix.\n\n Returns\n -------\n csr_data : tuple of nparray\n (rowptr, colptr, vals)\n ";
3853 static PyMethodDef __pyx_mdef_15superluWrappers_12SparseMatrix_7getCSRrepresentation = {
"getCSRrepresentation", (PyCFunction)__pyx_pw_15superluWrappers_12SparseMatrix_7getCSRrepresentation, METH_O, __pyx_doc_15superluWrappers_12SparseMatrix_6getCSRrepresentation};
3854 static PyObject *__pyx_pw_15superluWrappers_12SparseMatrix_7getCSRrepresentation(PyObject *__pyx_self, PyObject *__pyx_v_self) {
3855 PyObject *__pyx_r = 0;
3856 __Pyx_RefNannyDeclarations
3857 __Pyx_RefNannySetupContext(
"getCSRrepresentation (wrapper)", 0);
3858 __pyx_r = __pyx_pf_15superluWrappers_12SparseMatrix_6getCSRrepresentation(__pyx_self, ((PyObject *)__pyx_v_self));
3861 __Pyx_RefNannyFinishContext();
3865 static PyObject *__pyx_pf_15superluWrappers_12SparseMatrix_6getCSRrepresentation(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
3866 PyObject *__pyx_r = NULL;
3867 __Pyx_RefNannyDeclarations
3868 PyObject *__pyx_t_1 = NULL;
3869 PyObject *__pyx_t_2 = NULL;
3870 PyObject *__pyx_t_3 = NULL;
3871 PyObject *__pyx_t_4 = NULL;
3872 int __pyx_lineno = 0;
3873 const char *__pyx_filename = NULL;
3874 int __pyx_clineno = 0;
3875 __Pyx_RefNannySetupContext(
"getCSRrepresentation", 0);
3884 __Pyx_XDECREF(__pyx_r);
3885 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rowptr);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error)
3886 __Pyx_GOTREF(__pyx_t_1);
3887 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_colind);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error)
3888 __Pyx_GOTREF(__pyx_t_2);
3889 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nzvals);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 70, __pyx_L1_error)
3890 __Pyx_GOTREF(__pyx_t_3);
3891 __pyx_t_4 = PyTuple_New(3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 70, __pyx_L1_error)
3892 __Pyx_GOTREF(__pyx_t_4);
3893 __Pyx_GIVEREF(__pyx_t_1);
3894 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
3895 __Pyx_GIVEREF(__pyx_t_2);
3896 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
3897 __Pyx_GIVEREF(__pyx_t_3);
3898 PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
3902 __pyx_r = __pyx_t_4;
3916 __Pyx_XDECREF(__pyx_t_1);
3917 __Pyx_XDECREF(__pyx_t_2);
3918 __Pyx_XDECREF(__pyx_t_3);
3919 __Pyx_XDECREF(__pyx_t_4);
3920 __Pyx_AddTraceback(
"superluWrappers.SparseMatrix.getCSRrepresentation", __pyx_clineno, __pyx_lineno, __pyx_filename);
3923 __Pyx_XGIVEREF(__pyx_r);
3924 __Pyx_RefNannyFinishContext();
3937 static PyObject *__pyx_pw_15superluWrappers_12SparseMatrix_9getSubMatCSRrepresentation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
3938 static char __pyx_doc_15superluWrappers_12SparseMatrix_8getSubMatCSRrepresentation[] =
" Get the CSR representation for a submatrix.\n\n Arguments\n ---------\n range_start : int\n range_end : int\n\n Returns\n -------\n csr_data : tuple of nparray\n (rowptr, colind, nzvals)\n ";
3939 static PyMethodDef __pyx_mdef_15superluWrappers_12SparseMatrix_9getSubMatCSRrepresentation = {
"getSubMatCSRrepresentation", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_15superluWrappers_12SparseMatrix_9getSubMatCSRrepresentation, METH_VARARGS|METH_KEYWORDS, __pyx_doc_15superluWrappers_12SparseMatrix_8getSubMatCSRrepresentation};
3940 static PyObject *__pyx_pw_15superluWrappers_12SparseMatrix_9getSubMatCSRrepresentation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3941 PyObject *__pyx_v_self = 0;
3942 PyObject *__pyx_v_range_start = 0;
3943 PyObject *__pyx_v_range_end = 0;
3944 int __pyx_lineno = 0;
3945 const char *__pyx_filename = NULL;
3946 int __pyx_clineno = 0;
3947 PyObject *__pyx_r = 0;
3948 __Pyx_RefNannyDeclarations
3949 __Pyx_RefNannySetupContext(
"getSubMatCSRrepresentation (wrapper)", 0);
3951 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_range_start,&__pyx_n_s_range_end,0};
3952 PyObject* values[3] = {0,0,0};
3953 if (unlikely(__pyx_kwds)) {
3955 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3957 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3959 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3961 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3964 default:
goto __pyx_L5_argtuple_error;
3966 kw_args = PyDict_Size(__pyx_kwds);
3969 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
3970 else goto __pyx_L5_argtuple_error;
3973 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_range_start)) != 0)) kw_args--;
3975 __Pyx_RaiseArgtupleInvalid(
"getSubMatCSRrepresentation", 1, 3, 3, 1); __PYX_ERR(0, 72, __pyx_L3_error)
3979 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_range_end)) != 0)) kw_args--;
3981 __Pyx_RaiseArgtupleInvalid(
"getSubMatCSRrepresentation", 1, 3, 3, 2); __PYX_ERR(0, 72, __pyx_L3_error)
3984 if (unlikely(kw_args > 0)) {
3985 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"getSubMatCSRrepresentation") < 0)) __PYX_ERR(0, 72, __pyx_L3_error)
3987 }
else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
3988 goto __pyx_L5_argtuple_error;
3990 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3991 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3992 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3994 __pyx_v_self = values[0];
3995 __pyx_v_range_start = values[1];
3996 __pyx_v_range_end = values[2];
3998 goto __pyx_L4_argument_unpacking_done;
3999 __pyx_L5_argtuple_error:;
4000 __Pyx_RaiseArgtupleInvalid(
"getSubMatCSRrepresentation", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 72, __pyx_L3_error)
4002 __Pyx_AddTraceback(
"superluWrappers.SparseMatrix.getSubMatCSRrepresentation", __pyx_clineno, __pyx_lineno, __pyx_filename);
4003 __Pyx_RefNannyFinishContext();
4005 __pyx_L4_argument_unpacking_done:;
4006 __pyx_r = __pyx_pf_15superluWrappers_12SparseMatrix_8getSubMatCSRrepresentation(__pyx_self, __pyx_v_self, __pyx_v_range_start, __pyx_v_range_end);
4009 __Pyx_RefNannyFinishContext();
4013 static PyObject *__pyx_pf_15superluWrappers_12SparseMatrix_8getSubMatCSRrepresentation(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_range_start, PyObject *__pyx_v_range_end) {
4014 PyObject *__pyx_v__rows = NULL;
4015 PyObject *__pyx_v_nnz = NULL;
4016 PyObject *__pyx_v_rowptr = NULL;
4017 PyObject *__pyx_v_colind = NULL;
4018 PyObject *__pyx_v_nzvals = NULL;
4019 PyObject *__pyx_r = NULL;
4020 __Pyx_RefNannyDeclarations
4021 PyObject *__pyx_t_1 = NULL;
4023 PyObject *__pyx_t_3 = NULL;
4024 PyObject *__pyx_t_4 = NULL;
4025 PyObject *__pyx_t_5 = NULL;
4026 int __pyx_lineno = 0;
4027 const char *__pyx_filename = NULL;
4028 int __pyx_clineno = 0;
4029 __Pyx_RefNannySetupContext(
"getSubMatCSRrepresentation", 0);
4038 #ifndef CYTHON_WITHOUT_ASSERTIONS
4039 if (unlikely(!Py_OptimizeFlag)) {
4040 __pyx_t_1 = PyObject_RichCompare(__pyx_v_range_start, __pyx_int_0, Py_GE); __Pyx_XGOTREF(__pyx_t_1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 87, __pyx_L1_error)
4041 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1);
if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 87, __pyx_L1_error)
4042 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4043 if (unlikely(!__pyx_t_2)) {
4044 PyErr_SetNone(PyExc_AssertionError);
4045 __PYX_ERR(0, 87, __pyx_L1_error)
4049 #ifndef CYTHON_WITHOUT_ASSERTIONS
4050 if (unlikely(!Py_OptimizeFlag)) {
4051 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nr);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 87, __pyx_L1_error)
4052 __Pyx_GOTREF(__pyx_t_1);
4053 __pyx_t_3 = PyObject_RichCompare(__pyx_v_range_end, __pyx_t_1, Py_LE); __Pyx_XGOTREF(__pyx_t_3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 87, __pyx_L1_error)
4054 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4055 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3);
if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 87, __pyx_L1_error)
4056 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4057 if (unlikely(!__pyx_t_2)) {
4058 PyErr_SetNone(PyExc_AssertionError);
4059 __PYX_ERR(0, 87, __pyx_L1_error)
4071 #ifndef CYTHON_WITHOUT_ASSERTIONS
4072 if (unlikely(!Py_OptimizeFlag)) {
4073 __pyx_t_3 = PyObject_RichCompare(__pyx_v_range_end, __pyx_v_range_start, Py_GT); __Pyx_XGOTREF(__pyx_t_3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 88, __pyx_L1_error)
4074 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3);
if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 88, __pyx_L1_error)
4075 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4076 if (unlikely(!__pyx_t_2)) {
4077 PyErr_SetNone(PyExc_AssertionError);
4078 __PYX_ERR(0, 88, __pyx_L1_error)
4090 __pyx_t_3 = PyNumber_Subtract(__pyx_v_range_end, __pyx_v_range_start);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 89, __pyx_L1_error)
4091 __Pyx_GOTREF(__pyx_t_3);
4092 __pyx_v__rows = __pyx_t_3;
4102 #ifndef CYTHON_WITHOUT_ASSERTIONS
4103 if (unlikely(!Py_OptimizeFlag)) {
4104 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nr);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 90, __pyx_L1_error)
4105 __Pyx_GOTREF(__pyx_t_3);
4106 __pyx_t_1 = PyObject_RichCompare(__pyx_v__rows, __pyx_t_3, Py_LE); __Pyx_XGOTREF(__pyx_t_1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error)
4107 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4108 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1);
if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 90, __pyx_L1_error)
4109 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4110 if (unlikely(!__pyx_t_2)) {
4111 PyErr_SetNone(PyExc_AssertionError);
4112 __PYX_ERR(0, 90, __pyx_L1_error)
4124 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rowptr);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error)
4125 __Pyx_GOTREF(__pyx_t_1);
4126 __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_range_end);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 92, __pyx_L1_error)
4127 __Pyx_GOTREF(__pyx_t_3);
4128 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4129 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rowptr);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error)
4130 __Pyx_GOTREF(__pyx_t_1);
4131 __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_range_start);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 92, __pyx_L1_error)
4132 __Pyx_GOTREF(__pyx_t_4);
4133 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4134 __pyx_t_1 = PyNumber_Subtract(__pyx_t_3, __pyx_t_4);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error)
4135 __Pyx_GOTREF(__pyx_t_1);
4136 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4137 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4138 __pyx_v_nnz = __pyx_t_1;
4148 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rowptr);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 94, __pyx_L1_error)
4149 __Pyx_GOTREF(__pyx_t_1);
4150 __pyx_t_4 = PyNumber_Add(__pyx_v_range_start, __pyx_v__rows);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 94, __pyx_L1_error)
4151 __Pyx_GOTREF(__pyx_t_4);
4152 __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_4, __pyx_int_1, 1, 0, 0);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 94, __pyx_L1_error)
4153 __Pyx_GOTREF(__pyx_t_3);
4154 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4155 __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_t_1, 0, 0, &__pyx_v_range_start, &__pyx_t_3, NULL, 0, 0, 0);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 94, __pyx_L1_error)
4156 __Pyx_GOTREF(__pyx_t_4);
4157 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4158 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4159 __pyx_v_rowptr = __pyx_t_4;
4169 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_colind);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 95, __pyx_L1_error)
4170 __Pyx_GOTREF(__pyx_t_4);
4171 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rowptr);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 95, __pyx_L1_error)
4172 __Pyx_GOTREF(__pyx_t_3);
4173 __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_v_range_start);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 95, __pyx_L1_error)
4174 __Pyx_GOTREF(__pyx_t_1);
4175 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4176 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rowptr);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 95, __pyx_L1_error)
4177 __Pyx_GOTREF(__pyx_t_3);
4178 __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_v_range_start);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 95, __pyx_L1_error)
4179 __Pyx_GOTREF(__pyx_t_5);
4180 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4181 __pyx_t_3 = PyNumber_Add(__pyx_t_5, __pyx_v_nnz);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 95, __pyx_L1_error)
4182 __Pyx_GOTREF(__pyx_t_3);
4183 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4184 __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_t_4, 0, 0, &__pyx_t_1, &__pyx_t_3, NULL, 0, 0, 0);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 95, __pyx_L1_error)
4185 __Pyx_GOTREF(__pyx_t_5);
4186 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4187 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4188 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4189 __pyx_v_colind = __pyx_t_5;
4199 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nzvals);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 96, __pyx_L1_error)
4200 __Pyx_GOTREF(__pyx_t_5);
4201 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rowptr);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 96, __pyx_L1_error)
4202 __Pyx_GOTREF(__pyx_t_3);
4203 __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_v_range_start);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error)
4204 __Pyx_GOTREF(__pyx_t_1);
4205 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4206 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rowptr);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 96, __pyx_L1_error)
4207 __Pyx_GOTREF(__pyx_t_3);
4208 __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_v_range_start);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 96, __pyx_L1_error)
4209 __Pyx_GOTREF(__pyx_t_4);
4210 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4211 __pyx_t_3 = PyNumber_Add(__pyx_t_4, __pyx_v_nnz);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 96, __pyx_L1_error)
4212 __Pyx_GOTREF(__pyx_t_3);
4213 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4214 __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_t_5, 0, 0, &__pyx_t_1, &__pyx_t_3, NULL, 0, 0, 0);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 96, __pyx_L1_error)
4215 __Pyx_GOTREF(__pyx_t_4);
4216 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4217 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4218 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4219 __pyx_v_nzvals = __pyx_t_4;
4229 __Pyx_XDECREF(__pyx_r);
4230 __pyx_t_4 = PyTuple_New(3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 98, __pyx_L1_error)
4231 __Pyx_GOTREF(__pyx_t_4);
4232 __Pyx_INCREF(__pyx_v_rowptr);
4233 __Pyx_GIVEREF(__pyx_v_rowptr);
4234 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_rowptr);
4235 __Pyx_INCREF(__pyx_v_colind);
4236 __Pyx_GIVEREF(__pyx_v_colind);
4237 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_colind);
4238 __Pyx_INCREF(__pyx_v_nzvals);
4239 __Pyx_GIVEREF(__pyx_v_nzvals);
4240 PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_nzvals);
4241 __pyx_r = __pyx_t_4;
4255 __Pyx_XDECREF(__pyx_t_1);
4256 __Pyx_XDECREF(__pyx_t_3);
4257 __Pyx_XDECREF(__pyx_t_4);
4258 __Pyx_XDECREF(__pyx_t_5);
4259 __Pyx_AddTraceback(
"superluWrappers.SparseMatrix.getSubMatCSRrepresentation", __pyx_clineno, __pyx_lineno, __pyx_filename);
4262 __Pyx_XDECREF(__pyx_v__rows);
4263 __Pyx_XDECREF(__pyx_v_nnz);
4264 __Pyx_XDECREF(__pyx_v_rowptr);
4265 __Pyx_XDECREF(__pyx_v_colind);
4266 __Pyx_XDECREF(__pyx_v_nzvals);
4267 __Pyx_XGIVEREF(__pyx_r);
4268 __Pyx_RefNannyFinishContext();
4281 static int __pyx_pw_15superluWrappers_13cSparseMatrix_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
4282 static int __pyx_pw_15superluWrappers_13cSparseMatrix_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4286 __Pyx_memviewslice __pyx_v_nzval = { 0, 0, { 0 }, { 0 }, { 0 } };
4287 __Pyx_memviewslice __pyx_v_colind = { 0, 0, { 0 }, { 0 }, { 0 } };
4288 __Pyx_memviewslice __pyx_v_rowptr = { 0, 0, { 0 }, { 0 }, { 0 } };
4289 int __pyx_lineno = 0;
4290 const char *__pyx_filename = NULL;
4291 int __pyx_clineno = 0;
4293 __Pyx_RefNannyDeclarations
4294 __Pyx_RefNannySetupContext(
"__cinit__ (wrapper)", 0);
4296 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nr,&__pyx_n_s_nc,&__pyx_n_s_nnz,&__pyx_n_s_nzval,&__pyx_n_s_colind,&__pyx_n_s_rowptr,0};
4297 PyObject* values[6] = {0,0,0,0,0,0};
4298 if (unlikely(__pyx_kwds)) {
4300 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4302 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
4304 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4306 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4308 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4310 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4312 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4315 default:
goto __pyx_L5_argtuple_error;
4317 kw_args = PyDict_Size(__pyx_kwds);
4320 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nr)) != 0)) kw_args--;
4321 else goto __pyx_L5_argtuple_error;
4324 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nc)) != 0)) kw_args--;
4326 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 1, 6, 6, 1); __PYX_ERR(0, 102, __pyx_L3_error)
4330 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nnz)) != 0)) kw_args--;
4332 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 1, 6, 6, 2); __PYX_ERR(0, 102, __pyx_L3_error)
4336 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nzval)) != 0)) kw_args--;
4338 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 1, 6, 6, 3); __PYX_ERR(0, 102, __pyx_L3_error)
4342 if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_colind)) != 0)) kw_args--;
4344 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 1, 6, 6, 4); __PYX_ERR(0, 102, __pyx_L3_error)
4348 if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rowptr)) != 0)) kw_args--;
4350 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 1, 6, 6, 5); __PYX_ERR(0, 102, __pyx_L3_error)
4353 if (unlikely(kw_args > 0)) {
4354 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__cinit__") < 0)) __PYX_ERR(0, 102, __pyx_L3_error)
4356 }
else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
4357 goto __pyx_L5_argtuple_error;
4359 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4360 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4361 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4362 values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4363 values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4364 values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
4366 __pyx_v_nr = __Pyx_PyInt_As_int(values[0]);
if (unlikely((__pyx_v_nr == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 103, __pyx_L3_error)
4367 __pyx_v_nc = __Pyx_PyInt_As_int(values[1]);
if (unlikely((__pyx_v_nc == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 104, __pyx_L3_error)
4368 __pyx_v_nnz = __Pyx_PyInt_As_int(values[2]);
if (unlikely((__pyx_v_nnz == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 105, __pyx_L3_error)
4369 __pyx_v_nzval = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(values[3], PyBUF_WRITABLE);
if (unlikely(!__pyx_v_nzval.memview)) __PYX_ERR(0, 106, __pyx_L3_error)
4370 __pyx_v_colind = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int32_t(values[4], PyBUF_WRITABLE);
if (unlikely(!__pyx_v_colind.memview)) __PYX_ERR(0, 107, __pyx_L3_error)
4371 __pyx_v_rowptr = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int32_t(values[5], PyBUF_WRITABLE);
if (unlikely(!__pyx_v_rowptr.memview)) __PYX_ERR(0, 108, __pyx_L3_error)
4373 goto __pyx_L4_argument_unpacking_done;
4374 __pyx_L5_argtuple_error:;
4375 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 102, __pyx_L3_error)
4377 __Pyx_AddTraceback(
"superluWrappers.cSparseMatrix.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4378 __Pyx_RefNannyFinishContext();
4380 __pyx_L4_argument_unpacking_done:;
4381 __pyx_r = __pyx_pf_15superluWrappers_13cSparseMatrix___cinit__(((
struct __pyx_obj_15superluWrappers_cSparseMatrix *)__pyx_v_self), __pyx_v_nr, __pyx_v_nc, __pyx_v_nnz, __pyx_v_nzval, __pyx_v_colind, __pyx_v_rowptr);
4384 __Pyx_RefNannyFinishContext();
4388 static int __pyx_pf_15superluWrappers_13cSparseMatrix___cinit__(
struct __pyx_obj_15superluWrappers_cSparseMatrix *__pyx_v_self,
int __pyx_v_nr,
int __pyx_v_nc,
int __pyx_v_nnz, __Pyx_memviewslice __pyx_v_nzval, __Pyx_memviewslice __pyx_v_colind, __Pyx_memviewslice __pyx_v_rowptr) {
4390 __Pyx_RefNannyDeclarations
4391 Py_ssize_t __pyx_t_1;
4392 __Pyx_RefNannySetupContext(
"__cinit__", 0);
4401 (__pyx_v_self->dim[0]) = __pyx_v_nr;
4402 (__pyx_v_self->dim[1]) = __pyx_v_nc;
4411 __pyx_v_self->A.nnz = __pyx_v_nnz;
4421 __pyx_v_self->A.nzval = (&(*((__pyx_t_5numpy_float64_t *) ( (__pyx_v_nzval.data + __pyx_t_1 * __pyx_v_nzval.strides[0]) ))));
4431 __pyx_v_self->A.colind = (&(*((__pyx_t_5numpy_int32_t *) ( (__pyx_v_colind.data + __pyx_t_1 * __pyx_v_colind.strides[0]) ))));
4441 __pyx_v_self->A.rowptr = (&(*((__pyx_t_5numpy_int32_t *) ( (__pyx_v_rowptr.data + __pyx_t_1 * __pyx_v_rowptr.strides[0]) ))));
4453 __PYX_XDEC_MEMVIEW(&__pyx_v_nzval, 1);
4454 __PYX_XDEC_MEMVIEW(&__pyx_v_colind, 1);
4455 __PYX_XDEC_MEMVIEW(&__pyx_v_rowptr, 1);
4456 __Pyx_RefNannyFinishContext();
4467 static PyObject *__pyx_pw_15superluWrappers_13cSparseMatrix_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
4468 static PyObject *__pyx_pw_15superluWrappers_13cSparseMatrix_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
4469 PyObject *__pyx_r = 0;
4470 __Pyx_RefNannyDeclarations
4471 __Pyx_RefNannySetupContext(
"__reduce_cython__ (wrapper)", 0);
4472 __pyx_r = __pyx_pf_15superluWrappers_13cSparseMatrix_2__reduce_cython__(((
struct __pyx_obj_15superluWrappers_cSparseMatrix *)__pyx_v_self));
4475 __Pyx_RefNannyFinishContext();
4479 static PyObject *__pyx_pf_15superluWrappers_13cSparseMatrix_2__reduce_cython__(CYTHON_UNUSED
struct __pyx_obj_15superluWrappers_cSparseMatrix *__pyx_v_self) {
4480 PyObject *__pyx_r = NULL;
4481 __Pyx_RefNannyDeclarations
4482 PyObject *__pyx_t_1 = NULL;
4483 int __pyx_lineno = 0;
4484 const char *__pyx_filename = NULL;
4485 int __pyx_clineno = 0;
4486 __Pyx_RefNannySetupContext(
"__reduce_cython__", 0);
4494 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__2, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
4495 __Pyx_GOTREF(__pyx_t_1);
4496 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
4497 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4498 __PYX_ERR(1, 2, __pyx_L1_error)
4508 __Pyx_XDECREF(__pyx_t_1);
4509 __Pyx_AddTraceback(
"superluWrappers.cSparseMatrix.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4511 __Pyx_XGIVEREF(__pyx_r);
4512 __Pyx_RefNannyFinishContext();
4524 static PyObject *__pyx_pw_15superluWrappers_13cSparseMatrix_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state);
4525 static PyObject *__pyx_pw_15superluWrappers_13cSparseMatrix_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
4526 PyObject *__pyx_r = 0;
4527 __Pyx_RefNannyDeclarations
4528 __Pyx_RefNannySetupContext(
"__setstate_cython__ (wrapper)", 0);
4529 __pyx_r = __pyx_pf_15superluWrappers_13cSparseMatrix_4__setstate_cython__(((
struct __pyx_obj_15superluWrappers_cSparseMatrix *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
4532 __Pyx_RefNannyFinishContext();
4536 static PyObject *__pyx_pf_15superluWrappers_13cSparseMatrix_4__setstate_cython__(CYTHON_UNUSED
struct __pyx_obj_15superluWrappers_cSparseMatrix *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
4537 PyObject *__pyx_r = NULL;
4538 __Pyx_RefNannyDeclarations
4539 PyObject *__pyx_t_1 = NULL;
4540 int __pyx_lineno = 0;
4541 const char *__pyx_filename = NULL;
4542 int __pyx_clineno = 0;
4543 __Pyx_RefNannySetupContext(
"__setstate_cython__", 0);
4550 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
4551 __Pyx_GOTREF(__pyx_t_1);
4552 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
4553 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4554 __PYX_ERR(1, 4, __pyx_L1_error)
4565 __Pyx_XDECREF(__pyx_t_1);
4566 __Pyx_AddTraceback(
"superluWrappers.cSparseMatrix.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4568 __Pyx_XGIVEREF(__pyx_r);
4569 __Pyx_RefNannyFinishContext();
4581 static void __pyx_f_15superluWrappers_SparseMatrix_matvec(
struct __pyx_obj_15superluWrappers_cSparseMatrix *__pyx_v_sm, __Pyx_memviewslice __pyx_v_xp, __Pyx_memviewslice __pyx_v_yp) {
4582 __pyx_t_5numpy_float64_t __pyx_v_tmp;
4585 __Pyx_RefNannyDeclarations
4586 __pyx_t_5numpy_int32_t __pyx_t_1;
4587 __pyx_t_5numpy_int32_t __pyx_t_2;
4589 __pyx_t_5numpy_int32_t __pyx_t_4;
4590 __pyx_t_5numpy_int32_t __pyx_t_5;
4592 Py_ssize_t __pyx_t_7;
4593 __Pyx_RefNannySetupContext(
"SparseMatrix_matvec", 0);
4611 __pyx_t_1 = (__pyx_v_sm->dim[0]);
4612 __pyx_t_2 = __pyx_t_1;
4613 for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
4614 __pyx_v_i = __pyx_t_3;
4632 __pyx_t_4 = (__pyx_v_sm->A.rowptr[(__pyx_v_i + 1)]);
4633 __pyx_t_5 = __pyx_t_4;
4634 for (__pyx_t_6 = (__pyx_v_sm->A.rowptr[__pyx_v_i]); __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
4635 __pyx_v_k = __pyx_t_6;
4644 __pyx_t_7 = (__pyx_v_sm->A.colind[__pyx_v_k]);
4645 __pyx_v_tmp = (__pyx_v_tmp + ((__pyx_v_sm->A.nzval[__pyx_v_k]) * (*((__pyx_t_5numpy_float64_t *) ( (__pyx_v_xp.data + __pyx_t_7 * __pyx_v_xp.strides[0]) )))));
4655 __pyx_t_7 = __pyx_v_i;
4656 *((__pyx_t_5numpy_float64_t *) ( (__pyx_v_yp.data + __pyx_t_7 * __pyx_v_yp.strides[0]) )) = __pyx_v_tmp;
4668 __Pyx_RefNannyFinishContext();
4680 static int __pyx_pw_15superluWrappers_12SparseFactor_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
4681 static char __pyx_doc_15superluWrappers_12SparseFactor___init__[] =
"\n Arguments\n ---------\n dim : int\n Dimension of the sparse factor.\n ";
4682 #if CYTHON_COMPILING_IN_CPYTHON
4683 struct wrapperbase __pyx_wrapperbase_15superluWrappers_12SparseFactor___init__;
4685 static int __pyx_pw_15superluWrappers_12SparseFactor_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4686 PyObject *__pyx_v_dim = 0;
4687 int __pyx_lineno = 0;
4688 const char *__pyx_filename = NULL;
4689 int __pyx_clineno = 0;
4691 __Pyx_RefNannyDeclarations
4692 __Pyx_RefNannySetupContext(
"__init__ (wrapper)", 0);
4694 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dim,0};
4695 PyObject* values[1] = {0};
4696 if (unlikely(__pyx_kwds)) {
4698 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4700 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4703 default:
goto __pyx_L5_argtuple_error;
4705 kw_args = PyDict_Size(__pyx_kwds);
4708 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dim)) != 0)) kw_args--;
4709 else goto __pyx_L5_argtuple_error;
4711 if (unlikely(kw_args > 0)) {
4712 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__init__") < 0)) __PYX_ERR(0, 170, __pyx_L3_error)
4714 }
else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
4715 goto __pyx_L5_argtuple_error;
4717 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4719 __pyx_v_dim = values[0];
4721 goto __pyx_L4_argument_unpacking_done;
4722 __pyx_L5_argtuple_error:;
4723 __Pyx_RaiseArgtupleInvalid(
"__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 170, __pyx_L3_error)
4725 __Pyx_AddTraceback(
"superluWrappers.SparseFactor.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4726 __Pyx_RefNannyFinishContext();
4728 __pyx_L4_argument_unpacking_done:;
4729 __pyx_r = __pyx_pf_15superluWrappers_12SparseFactor___init__(((
struct __pyx_obj_15superluWrappers_SparseFactor *)__pyx_v_self), __pyx_v_dim);
4732 __Pyx_RefNannyFinishContext();
4736 static int __pyx_pf_15superluWrappers_12SparseFactor___init__(
struct __pyx_obj_15superluWrappers_SparseFactor *__pyx_v_self, PyObject *__pyx_v_dim) {
4738 __Pyx_RefNannyDeclarations
4739 PyObject *__pyx_t_1 = NULL;
4741 __pyx_t_5numpy_int32_t __pyx_t_3;
4742 PyObject *__pyx_t_4 = NULL;
4744 int __pyx_lineno = 0;
4745 const char *__pyx_filename = NULL;
4746 int __pyx_clineno = 0;
4747 __Pyx_RefNannySetupContext(
"__init__", 0);
4756 StatInit((&__pyx_v_self->stat));
4765 set_default_options((&__pyx_v_self->options));
4774 __pyx_t_1 = ((
struct __pyx_vtabstruct_15superluWrappers_SparseFactor *)__pyx_v_self->__pyx_vtab)->_set_mat_types(__pyx_v_self);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 179, __pyx_L1_error)
4775 __Pyx_GOTREF(__pyx_t_1);
4776 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4785 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_dim);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L1_error)
4786 __pyx_v_self->dim = __pyx_t_2;
4795 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_dim);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 181, __pyx_L1_error)
4796 __pyx_v_self->A.nrow = __pyx_t_2;
4797 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_dim);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 181, __pyx_L1_error)
4798 __pyx_v_self->A.ncol = __pyx_t_2;
4807 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_dim);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 182, __pyx_L1_error)
4808 __pyx_v_self->AC.nrow = __pyx_t_2;
4809 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_dim);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 182, __pyx_L1_error)
4810 __pyx_v_self->AC.ncol = __pyx_t_2;
4819 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_dim);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 183, __pyx_L1_error)
4820 __pyx_v_self->L.nrow = __pyx_t_2;
4821 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_dim);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 183, __pyx_L1_error)
4822 __pyx_v_self->L.ncol = __pyx_t_2;
4831 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_dim);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 184, __pyx_L1_error)
4832 __pyx_v_self->U.nrow = __pyx_t_2;
4833 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_dim);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 184, __pyx_L1_error)
4834 __pyx_v_self->U.ncol = __pyx_t_2;
4843 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_dim);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 185, __pyx_L1_error)
4844 __pyx_v_self->X.nrow = __pyx_t_2;
4845 __pyx_v_self->X.ncol = 1;
4854 __pyx_t_3 = __Pyx_PyInt_As_npy_int32(__pyx_v_dim);
if (unlikely((__pyx_t_3 == ((npy_int32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 186, __pyx_L1_error)
4855 __pyx_v_self->storeX.lda = __pyx_t_3;
4864 __pyx_v_self->use_same_perm_c = 0;
4873 __pyx_v_self->use_same_sparsity = 0;
4882 __pyx_t_1 = __Pyx_PyInt_FromSize_t((
sizeof(__pyx_t_5numpy_int32_t)));
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 189, __pyx_L1_error)
4883 __Pyx_GOTREF(__pyx_t_1);
4884 __pyx_t_4 = PyNumber_Multiply(__pyx_v_dim, __pyx_t_1);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 189, __pyx_L1_error)
4885 __Pyx_GOTREF(__pyx_t_4);
4886 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4887 __pyx_t_5 = __Pyx_PyInt_As_size_t(__pyx_t_4);
if (unlikely((__pyx_t_5 == (
size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 189, __pyx_L1_error)
4888 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4889 __pyx_v_self->perm_c = ((
int *)malloc(__pyx_t_5));
4898 __pyx_t_4 = __Pyx_PyInt_FromSize_t((
sizeof(__pyx_t_5numpy_int32_t)));
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 190, __pyx_L1_error)
4899 __Pyx_GOTREF(__pyx_t_4);
4900 __pyx_t_1 = PyNumber_Multiply(__pyx_v_dim, __pyx_t_4);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __pyx_L1_error)
4901 __Pyx_GOTREF(__pyx_t_1);
4902 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4903 __pyx_t_5 = __Pyx_PyInt_As_size_t(__pyx_t_1);
if (unlikely((__pyx_t_5 == (
size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 190, __pyx_L1_error)
4904 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4905 __pyx_v_self->perm_r = ((
int *)malloc(__pyx_t_5));
4914 __pyx_t_1 = __Pyx_PyInt_FromSize_t((
sizeof(__pyx_t_5numpy_int32_t)));
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 191, __pyx_L1_error)
4915 __Pyx_GOTREF(__pyx_t_1);
4916 __pyx_t_4 = PyNumber_Multiply(__pyx_v_dim, __pyx_t_1);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 191, __pyx_L1_error)
4917 __Pyx_GOTREF(__pyx_t_4);
4918 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4919 __pyx_t_5 = __Pyx_PyInt_As_size_t(__pyx_t_4);
if (unlikely((__pyx_t_5 == (
size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 191, __pyx_L1_error)
4920 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4921 __pyx_v_self->etree = ((
int *)malloc(__pyx_t_5));
4935 __Pyx_XDECREF(__pyx_t_1);
4936 __Pyx_XDECREF(__pyx_t_4);
4937 __Pyx_AddTraceback(
"superluWrappers.SparseFactor.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4940 __Pyx_RefNannyFinishContext();
4952 static PyObject *__pyx_f_15superluWrappers_12SparseFactor__set_mat_types(
struct __pyx_obj_15superluWrappers_SparseFactor *__pyx_v_self) {
4953 PyObject *__pyx_r = NULL;
4954 __Pyx_RefNannyDeclarations
4955 __Pyx_RefNannySetupContext(
"_set_mat_types", 0);
4964 __pyx_v_self->A.Stype = SLU_NC;
4973 __pyx_v_self->A.Dtype = SLU_D;
4982 __pyx_v_self->A.Mtype = SLU_GE;
4991 __pyx_v_self->A.Store = (&__pyx_v_self->storeA);
5000 __pyx_v_self->AC.Stype = SLU_NCP;
5009 __pyx_v_self->AC.Dtype = SLU_D;
5018 __pyx_v_self->AC.Mtype = SLU_GE;
5027 __pyx_v_self->AC.Store = NULL;
5036 __pyx_v_self->L.Stype = SLU_NC;
5045 __pyx_v_self->L.Dtype = SLU_D;
5054 __pyx_v_self->L.Mtype = SLU_TRLU;
5063 __pyx_v_self->L.Store = NULL;
5072 __pyx_v_self->U.Stype = SLU_NC;
5081 __pyx_v_self->U.Dtype = SLU_D;
5090 __pyx_v_self->U.Mtype = SLU_TRU;
5099 __pyx_v_self->U.Store = NULL;
5108 __pyx_v_self->X.Stype = SLU_DN;
5117 __pyx_v_self->X.Dtype = SLU_D;
5126 __pyx_v_self->X.Mtype = SLU_GE;
5135 __pyx_v_self->X.Store = (&__pyx_v_self->storeX);
5146 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5147 __Pyx_XGIVEREF(__pyx_r);
5148 __Pyx_RefNannyFinishContext();
5161 static PyObject *__pyx_pw_15superluWrappers_12SparseFactor_3dim_1__get__(PyObject *__pyx_v_self);
5162 static PyObject *__pyx_pw_15superluWrappers_12SparseFactor_3dim_1__get__(PyObject *__pyx_v_self) {
5163 PyObject *__pyx_r = 0;
5164 __Pyx_RefNannyDeclarations
5165 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
5166 __pyx_r = __pyx_pf_15superluWrappers_12SparseFactor_3dim___get__(((
struct __pyx_obj_15superluWrappers_SparseFactor *)__pyx_v_self));
5169 __Pyx_RefNannyFinishContext();
5173 static PyObject *__pyx_pf_15superluWrappers_12SparseFactor_3dim___get__(
struct __pyx_obj_15superluWrappers_SparseFactor *__pyx_v_self) {
5174 PyObject *__pyx_r = NULL;
5175 __Pyx_RefNannyDeclarations
5176 PyObject *__pyx_t_1 = NULL;
5177 int __pyx_lineno = 0;
5178 const char *__pyx_filename = NULL;
5179 int __pyx_clineno = 0;
5180 __Pyx_RefNannySetupContext(
"__get__", 0);
5181 __Pyx_XDECREF(__pyx_r);
5182 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->dim);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 168, __pyx_L1_error)
5183 __Pyx_GOTREF(__pyx_t_1);
5184 __pyx_r = __pyx_t_1;
5190 __Pyx_XDECREF(__pyx_t_1);
5191 __Pyx_AddTraceback(
"superluWrappers.SparseFactor.dim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5194 __Pyx_XGIVEREF(__pyx_r);
5195 __Pyx_RefNannyFinishContext();
5200 static int __pyx_pw_15superluWrappers_12SparseFactor_3dim_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value);
5201 static int __pyx_pw_15superluWrappers_12SparseFactor_3dim_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
5203 __Pyx_RefNannyDeclarations
5204 __Pyx_RefNannySetupContext(
"__set__ (wrapper)", 0);
5205 __pyx_r = __pyx_pf_15superluWrappers_12SparseFactor_3dim_2__set__(((
struct __pyx_obj_15superluWrappers_SparseFactor *)__pyx_v_self), ((PyObject *)__pyx_v_value));
5208 __Pyx_RefNannyFinishContext();
5212 static int __pyx_pf_15superluWrappers_12SparseFactor_3dim_2__set__(
struct __pyx_obj_15superluWrappers_SparseFactor *__pyx_v_self, PyObject *__pyx_v_value) {
5214 __Pyx_RefNannyDeclarations
5216 int __pyx_lineno = 0;
5217 const char *__pyx_filename = NULL;
5218 int __pyx_clineno = 0;
5219 __Pyx_RefNannySetupContext(
"__set__", 0);
5220 __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_value);
if (unlikely((__pyx_t_1 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 168, __pyx_L1_error)
5221 __pyx_v_self->dim = __pyx_t_1;
5227 __Pyx_AddTraceback(
"superluWrappers.SparseFactor.dim.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5230 __Pyx_RefNannyFinishContext();
5241 static PyObject *__pyx_pw_15superluWrappers_12SparseFactor_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
5242 static PyObject *__pyx_pw_15superluWrappers_12SparseFactor_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
5243 PyObject *__pyx_r = 0;
5244 __Pyx_RefNannyDeclarations
5245 __Pyx_RefNannySetupContext(
"__reduce_cython__ (wrapper)", 0);
5246 __pyx_r = __pyx_pf_15superluWrappers_12SparseFactor_2__reduce_cython__(((
struct __pyx_obj_15superluWrappers_SparseFactor *)__pyx_v_self));
5249 __Pyx_RefNannyFinishContext();
5253 static PyObject *__pyx_pf_15superluWrappers_12SparseFactor_2__reduce_cython__(CYTHON_UNUSED
struct __pyx_obj_15superluWrappers_SparseFactor *__pyx_v_self) {
5254 PyObject *__pyx_r = NULL;
5255 __Pyx_RefNannyDeclarations
5256 PyObject *__pyx_t_1 = NULL;
5257 int __pyx_lineno = 0;
5258 const char *__pyx_filename = NULL;
5259 int __pyx_clineno = 0;
5260 __Pyx_RefNannySetupContext(
"__reduce_cython__", 0);
5268 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__4, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
5269 __Pyx_GOTREF(__pyx_t_1);
5270 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
5271 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5272 __PYX_ERR(1, 2, __pyx_L1_error)
5282 __Pyx_XDECREF(__pyx_t_1);
5283 __Pyx_AddTraceback(
"superluWrappers.SparseFactor.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5285 __Pyx_XGIVEREF(__pyx_r);
5286 __Pyx_RefNannyFinishContext();
5298 static PyObject *__pyx_pw_15superluWrappers_12SparseFactor_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state);
5299 static PyObject *__pyx_pw_15superluWrappers_12SparseFactor_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
5300 PyObject *__pyx_r = 0;
5301 __Pyx_RefNannyDeclarations
5302 __Pyx_RefNannySetupContext(
"__setstate_cython__ (wrapper)", 0);
5303 __pyx_r = __pyx_pf_15superluWrappers_12SparseFactor_4__setstate_cython__(((
struct __pyx_obj_15superluWrappers_SparseFactor *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
5306 __Pyx_RefNannyFinishContext();
5310 static PyObject *__pyx_pf_15superluWrappers_12SparseFactor_4__setstate_cython__(CYTHON_UNUSED
struct __pyx_obj_15superluWrappers_SparseFactor *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
5311 PyObject *__pyx_r = NULL;
5312 __Pyx_RefNannyDeclarations
5313 PyObject *__pyx_t_1 = NULL;
5314 int __pyx_lineno = 0;
5315 const char *__pyx_filename = NULL;
5316 int __pyx_clineno = 0;
5317 __Pyx_RefNannySetupContext(
"__setstate_cython__", 0);
5324 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__5, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
5325 __Pyx_GOTREF(__pyx_t_1);
5326 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
5327 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5328 __PYX_ERR(1, 4, __pyx_L1_error)
5339 __Pyx_XDECREF(__pyx_t_1);
5340 __Pyx_AddTraceback(
"superluWrappers.SparseFactor.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5342 __Pyx_XGIVEREF(__pyx_r);
5343 __Pyx_RefNannyFinishContext();
5356 static PyObject *__pyx_pw_15superluWrappers_1sparseFactorPrepare(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
5357 static char __pyx_doc_15superluWrappers_sparseFactorPrepare[] =
" Python wrapper for superlu Sparse Factor Prepare function.\n\n Arguments\n ---------\n sparse_matrix : superluWrappers.SparseMatrix\n sparseFactor: superluWrappers.SparseFactor\n\n ";
5358 static PyMethodDef __pyx_mdef_15superluWrappers_1sparseFactorPrepare = {
"sparseFactorPrepare", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_15superluWrappers_1sparseFactorPrepare, METH_VARARGS|METH_KEYWORDS, __pyx_doc_15superluWrappers_sparseFactorPrepare};
5359 static PyObject *__pyx_pw_15superluWrappers_1sparseFactorPrepare(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5360 PyObject *__pyx_v_sparse_matrix = 0;
5361 PyObject *__pyx_v_sparseFactor = 0;
5362 int __pyx_lineno = 0;
5363 const char *__pyx_filename = NULL;
5364 int __pyx_clineno = 0;
5365 PyObject *__pyx_r = 0;
5366 __Pyx_RefNannyDeclarations
5367 __Pyx_RefNannySetupContext(
"sparseFactorPrepare (wrapper)", 0);
5369 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sparse_matrix,&__pyx_n_s_sparseFactor,0};
5370 PyObject* values[2] = {0,0};
5371 if (unlikely(__pyx_kwds)) {
5373 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5375 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5377 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5380 default:
goto __pyx_L5_argtuple_error;
5382 kw_args = PyDict_Size(__pyx_kwds);
5385 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sparse_matrix)) != 0)) kw_args--;
5386 else goto __pyx_L5_argtuple_error;
5389 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sparseFactor)) != 0)) kw_args--;
5391 __Pyx_RaiseArgtupleInvalid(
"sparseFactorPrepare", 1, 2, 2, 1); __PYX_ERR(0, 219, __pyx_L3_error)
5394 if (unlikely(kw_args > 0)) {
5395 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"sparseFactorPrepare") < 0)) __PYX_ERR(0, 219, __pyx_L3_error)
5397 }
else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
5398 goto __pyx_L5_argtuple_error;
5400 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5401 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5403 __pyx_v_sparse_matrix = values[0];
5404 __pyx_v_sparseFactor = values[1];
5406 goto __pyx_L4_argument_unpacking_done;
5407 __pyx_L5_argtuple_error:;
5408 __Pyx_RaiseArgtupleInvalid(
"sparseFactorPrepare", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 219, __pyx_L3_error)
5410 __Pyx_AddTraceback(
"superluWrappers.sparseFactorPrepare", __pyx_clineno, __pyx_lineno, __pyx_filename);
5411 __Pyx_RefNannyFinishContext();
5413 __pyx_L4_argument_unpacking_done:;
5414 __pyx_r = __pyx_pf_15superluWrappers_sparseFactorPrepare(__pyx_self, __pyx_v_sparse_matrix, __pyx_v_sparseFactor);
5417 __Pyx_RefNannyFinishContext();
5421 static PyObject *__pyx_pf_15superluWrappers_sparseFactorPrepare(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sparse_matrix, PyObject *__pyx_v_sparseFactor) {
5422 PyObject *__pyx_r = NULL;
5423 __Pyx_RefNannyDeclarations
5424 PyObject *__pyx_t_1 = NULL;
5425 int __pyx_lineno = 0;
5426 const char *__pyx_filename = NULL;
5427 int __pyx_clineno = 0;
5428 __Pyx_RefNannySetupContext(
"sparseFactorPrepare", 0);
5437 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sparse_matrix, __pyx_n_s_cSparseMatrix);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 229, __pyx_L1_error)
5438 __Pyx_GOTREF(__pyx_t_1);
5439 if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_15superluWrappers_cSparseMatrix))))) __PYX_ERR(0, 229, __pyx_L1_error)
5448 if (!(likely(((__pyx_v_sparseFactor) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_sparseFactor, __pyx_ptype_15superluWrappers_SparseFactor))))) __PYX_ERR(0, 230, __pyx_L1_error)
5457 __pyx_f_15superluWrappers_superluWrappersSparseFactorPrepare(((
struct __pyx_obj_15superluWrappers_cSparseMatrix *)__pyx_t_1), ((
struct __pyx_obj_15superluWrappers_SparseFactor *)__pyx_v_sparseFactor));
5458 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5469 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5472 __Pyx_XDECREF(__pyx_t_1);
5473 __Pyx_AddTraceback(
"superluWrappers.sparseFactorPrepare", __pyx_clineno, __pyx_lineno, __pyx_filename);
5476 __Pyx_XGIVEREF(__pyx_r);
5477 __Pyx_RefNannyFinishContext();
5489 static void __pyx_f_15superluWrappers_superluWrappersSparseFactorPrepare(
struct __pyx_obj_15superluWrappers_cSparseMatrix *__pyx_v_sm,
struct __pyx_obj_15superluWrappers_SparseFactor *__pyx_v_sparseFactor) {
5490 int __pyx_v_permc_spec;
5493 int __pyx_v_panel_size;
5497 PyObject *__pyx_v_i = NULL;
5498 __Pyx_RefNannyDeclarations
5499 __pyx_t_5numpy_int32_t __pyx_t_1;
5502 PyObject *__pyx_t_4 = NULL;
5503 PyObject *__pyx_t_5 = NULL;
5504 Py_ssize_t __pyx_t_6;
5505 PyObject *(*__pyx_t_7)(PyObject *);
5506 Py_ssize_t __pyx_t_8;
5507 Py_ssize_t __pyx_t_9;
5508 int __pyx_lineno = 0;
5509 const char *__pyx_filename = NULL;
5510 int __pyx_clineno = 0;
5511 __Pyx_RefNannySetupContext(
"superluWrappersSparseFactorPrepare", 0);
5520 __pyx_v_permc_spec = 3;
5538 __pyx_v_panel_size = 10;
5565 __pyx_v_work = NULL;
5574 __pyx_t_1 = __pyx_v_sm->A.nnz;
5575 __pyx_v_sparseFactor->storeA.nnz = __pyx_t_1;
5584 __pyx_v_sparseFactor->storeA.nzval = (&(__pyx_v_sm->A.nzval[0]));
5593 __pyx_v_sparseFactor->storeA.colptr = (&(__pyx_v_sm->A.rowptr[0]));
5602 __pyx_v_sparseFactor->storeA.rowind = (&(__pyx_v_sm->A.colind[0]));
5611 __pyx_t_2 = ((__pyx_v_sparseFactor->use_same_perm_c == 0) != 0);
5621 get_perm_c(__pyx_v_permc_spec, (&__pyx_v_sparseFactor->A), __pyx_v_sparseFactor->perm_c);
5630 __pyx_v_sparseFactor->use_same_perm_c = 1;
5648 __pyx_t_2 = ((__pyx_v_sparseFactor->use_same_sparsity == 0) != 0);
5658 __pyx_t_2 = ((__pyx_v_sparseFactor->AC.Store != NULL) != 0);
5668 Destroy_CompCol_Permuted((&__pyx_v_sparseFactor->AC));
5677 Destroy_SuperNode_Matrix((&__pyx_v_sparseFactor->L));
5686 Destroy_CompCol_Matrix((&__pyx_v_sparseFactor->U));
5704 sp_preorder((&__pyx_v_sparseFactor->options), (&__pyx_v_sparseFactor->A), __pyx_v_sparseFactor->perm_c, __pyx_v_sparseFactor->etree, (&__pyx_v_sparseFactor->AC));
5713 __pyx_v_sparseFactor->use_same_sparsity = 1;
5733 __pyx_v_sparseFactor->options.Fact = SamePattern_SameRowPerm;
5742 __pyx_t_3 = __pyx_v_sparseFactor->A.ncol;
5743 __pyx_v_n = __pyx_t_3;
5752 __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_n);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 268, __pyx_L1_error)
5753 __Pyx_GOTREF(__pyx_t_4);
5754 __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_4);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 268, __pyx_L1_error)
5755 __Pyx_GOTREF(__pyx_t_5);
5756 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5757 if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) {
5758 __pyx_t_4 = __pyx_t_5; __Pyx_INCREF(__pyx_t_4); __pyx_t_6 = 0;
5761 __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_5);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 268, __pyx_L1_error)
5762 __Pyx_GOTREF(__pyx_t_4);
5763 __pyx_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext;
if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 268, __pyx_L1_error)
5765 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5767 if (likely(!__pyx_t_7)) {
5768 if (likely(PyList_CheckExact(__pyx_t_4))) {
5769 if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4))
break;
5770 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5771 __pyx_t_5 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++;
if (unlikely(0 < 0)) __PYX_ERR(0, 268, __pyx_L1_error)
5773 __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++;
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 268, __pyx_L1_error)
5774 __Pyx_GOTREF(__pyx_t_5);
5777 if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4))
break;
5778 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5779 __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++;
if (unlikely(0 < 0)) __PYX_ERR(0, 268, __pyx_L1_error)
5781 __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++;
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 268, __pyx_L1_error)
5782 __Pyx_GOTREF(__pyx_t_5);
5786 __pyx_t_5 = __pyx_t_7(__pyx_t_4);
5787 if (unlikely(!__pyx_t_5)) {
5788 PyObject* exc_type = PyErr_Occurred();
5790 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
5791 else __PYX_ERR(0, 268, __pyx_L1_error)
5795 __Pyx_GOTREF(__pyx_t_5);
5797 __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_5);
5807 __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i);
if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 269, __pyx_L1_error)
5808 __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i);
if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 269, __pyx_L1_error)
5809 (((
struct __pyx_t_15superluWrappers__NCPformat *)__pyx_v_sparseFactor->AC.Store)->colbeg[(__pyx_v_sparseFactor->perm_c[__pyx_t_9])]) = (((
struct __pyx_t_15superluWrappers__NCformat *)__pyx_v_sparseFactor->A.Store)->colptr[__pyx_t_8]);
5818 __pyx_t_5 = __Pyx_PyInt_AddObjC(__pyx_v_i, __pyx_int_1, 1, 0, 0);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 270, __pyx_L1_error)
5819 __Pyx_GOTREF(__pyx_t_5);
5820 __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5);
if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 270, __pyx_L1_error)
5821 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5822 __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i);
if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 270, __pyx_L1_error)
5823 (((
struct __pyx_t_15superluWrappers__NCPformat *)__pyx_v_sparseFactor->AC.Store)->colend[(__pyx_v_sparseFactor->perm_c[__pyx_t_9])]) = (((
struct __pyx_t_15superluWrappers__NCformat *)__pyx_v_sparseFactor->A.Store)->colptr[__pyx_t_8]);
5833 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5844 dgstrf((&__pyx_v_sparseFactor->options), (&__pyx_v_sparseFactor->AC), __pyx_v_relax, __pyx_v_panel_size, __pyx_v_sparseFactor->etree, __pyx_v_work, __pyx_v_lwork, __pyx_v_sparseFactor->perm_c, __pyx_v_sparseFactor->perm_r, (&__pyx_v_sparseFactor->L), (&__pyx_v_sparseFactor->U), (&__pyx_v_sparseFactor->Glu), (&__pyx_v_sparseFactor->stat), (&__pyx_v_info));
5857 __Pyx_XDECREF(__pyx_t_4);
5858 __Pyx_XDECREF(__pyx_t_5);
5859 __Pyx_WriteUnraisable(
"superluWrappers.superluWrappersSparseFactorPrepare", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
5861 __Pyx_XDECREF(__pyx_v_i);
5862 __Pyx_RefNannyFinishContext();
5874 static PyObject *__pyx_pw_15superluWrappers_3sparseFactorSolve(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
5875 static char __pyx_doc_15superluWrappers_2sparseFactorSolve[] =
" Sparse factor solve wrappers\n\n Arguments\n ---------\n sparseFactor : superluWrappers.SparseFactor\n x (input / output) : np.array\n x serves as the right hand side and then becomes the solution\n ";
5876 static PyMethodDef __pyx_mdef_15superluWrappers_3sparseFactorSolve = {
"sparseFactorSolve", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_15superluWrappers_3sparseFactorSolve, METH_VARARGS|METH_KEYWORDS, __pyx_doc_15superluWrappers_2sparseFactorSolve};
5877 static PyObject *__pyx_pw_15superluWrappers_3sparseFactorSolve(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5878 PyObject *__pyx_v_sparseFactor = 0;
5879 PyObject *__pyx_v_x = 0;
5880 int __pyx_lineno = 0;
5881 const char *__pyx_filename = NULL;
5882 int __pyx_clineno = 0;
5883 PyObject *__pyx_r = 0;
5884 __Pyx_RefNannyDeclarations
5885 __Pyx_RefNannySetupContext(
"sparseFactorSolve (wrapper)", 0);
5887 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sparseFactor,&__pyx_n_s_x,0};
5888 PyObject* values[2] = {0,0};
5889 if (unlikely(__pyx_kwds)) {
5891 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5893 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5895 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5898 default:
goto __pyx_L5_argtuple_error;
5900 kw_args = PyDict_Size(__pyx_kwds);
5903 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sparseFactor)) != 0)) kw_args--;
5904 else goto __pyx_L5_argtuple_error;
5907 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
5909 __Pyx_RaiseArgtupleInvalid(
"sparseFactorSolve", 1, 2, 2, 1); __PYX_ERR(0, 286, __pyx_L3_error)
5912 if (unlikely(kw_args > 0)) {
5913 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"sparseFactorSolve") < 0)) __PYX_ERR(0, 286, __pyx_L3_error)
5915 }
else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
5916 goto __pyx_L5_argtuple_error;
5918 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5919 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5921 __pyx_v_sparseFactor = values[0];
5922 __pyx_v_x = values[1];
5924 goto __pyx_L4_argument_unpacking_done;
5925 __pyx_L5_argtuple_error:;
5926 __Pyx_RaiseArgtupleInvalid(
"sparseFactorSolve", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 286, __pyx_L3_error)
5928 __Pyx_AddTraceback(
"superluWrappers.sparseFactorSolve", __pyx_clineno, __pyx_lineno, __pyx_filename);
5929 __Pyx_RefNannyFinishContext();
5931 __pyx_L4_argument_unpacking_done:;
5932 __pyx_r = __pyx_pf_15superluWrappers_2sparseFactorSolve(__pyx_self, __pyx_v_sparseFactor, __pyx_v_x);
5935 __Pyx_RefNannyFinishContext();
5939 static PyObject *__pyx_pf_15superluWrappers_2sparseFactorSolve(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sparseFactor, PyObject *__pyx_v_x) {
5940 PyObject *__pyx_r = NULL;
5941 __Pyx_RefNannyDeclarations
5942 __Pyx_memviewslice __pyx_t_1 = { 0, 0, { 0 }, { 0 }, { 0 } };
5943 int __pyx_lineno = 0;
5944 const char *__pyx_filename = NULL;
5945 int __pyx_clineno = 0;
5946 __Pyx_RefNannySetupContext(
"sparseFactorSolve", 0);
5955 if (!(likely(((__pyx_v_sparseFactor) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_sparseFactor, __pyx_ptype_15superluWrappers_SparseFactor))))) __PYX_ERR(0, 296, __pyx_L1_error)
5964 __pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(__pyx_v_x, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 297, __pyx_L1_error)
5973 __pyx_f_15superluWrappers_superluWrappersSparseFactorSolve(((
struct __pyx_obj_15superluWrappers_SparseFactor *)__pyx_v_sparseFactor), __pyx_t_1);
5974 __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
5975 __pyx_t_1.memview = NULL;
5976 __pyx_t_1.data = NULL;
5987 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5990 __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
5991 __Pyx_AddTraceback(
"superluWrappers.sparseFactorSolve", __pyx_clineno, __pyx_lineno, __pyx_filename);
5994 __Pyx_XGIVEREF(__pyx_r);
5995 __Pyx_RefNannyFinishContext();
6007 static void __pyx_f_15superluWrappers_superluWrappersSparseFactorSolve(
struct __pyx_obj_15superluWrappers_SparseFactor *__pyx_v_sparseFactor, __Pyx_memviewslice __pyx_v_x) {
6008 trans_t __pyx_v_trans;
6010 __Pyx_RefNannyDeclarations
6011 Py_ssize_t __pyx_t_1;
6012 __Pyx_RefNannySetupContext(
"superluWrappersSparseFactorSolve", 0);
6021 __pyx_v_trans = TRANS;
6040 __pyx_v_sparseFactor->storeX.nzval = (&(*((__pyx_t_5numpy_float64_t *) ( (__pyx_v_x.data + __pyx_t_1 * __pyx_v_x.strides[0]) ))));
6049 dgstrs(__pyx_v_trans, (&__pyx_v_sparseFactor->L), (&__pyx_v_sparseFactor->U), __pyx_v_sparseFactor->perm_c, __pyx_v_sparseFactor->perm_r, (&__pyx_v_sparseFactor->X), (&__pyx_v_sparseFactor->stat), (&__pyx_v_info));
6060 __Pyx_RefNannyFinishContext();
6071 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
6072 PyObject *__pyx_r = NULL;
6073 __Pyx_RefNannyDeclarations
6074 PyObject *__pyx_t_1 = NULL;
6075 int __pyx_lineno = 0;
6076 const char *__pyx_filename = NULL;
6077 int __pyx_clineno = 0;
6078 __Pyx_RefNannySetupContext(
"PyArray_MultiIterNew1", 0);
6087 __Pyx_XDECREF(__pyx_r);
6088 __pyx_t_1 = PyArray_MultiIterNew(1, ((
void *)__pyx_v_a));
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 736, __pyx_L1_error)
6089 __Pyx_GOTREF(__pyx_t_1);
6090 __pyx_r = __pyx_t_1;
6104 __Pyx_XDECREF(__pyx_t_1);
6105 __Pyx_AddTraceback(
"numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
6108 __Pyx_XGIVEREF(__pyx_r);
6109 __Pyx_RefNannyFinishContext();
6121 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
6122 PyObject *__pyx_r = NULL;
6123 __Pyx_RefNannyDeclarations
6124 PyObject *__pyx_t_1 = NULL;
6125 int __pyx_lineno = 0;
6126 const char *__pyx_filename = NULL;
6127 int __pyx_clineno = 0;
6128 __Pyx_RefNannySetupContext(
"PyArray_MultiIterNew2", 0);
6137 __Pyx_XDECREF(__pyx_r);
6138 __pyx_t_1 = PyArray_MultiIterNew(2, ((
void *)__pyx_v_a), ((
void *)__pyx_v_b));
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 739, __pyx_L1_error)
6139 __Pyx_GOTREF(__pyx_t_1);
6140 __pyx_r = __pyx_t_1;
6154 __Pyx_XDECREF(__pyx_t_1);
6155 __Pyx_AddTraceback(
"numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
6158 __Pyx_XGIVEREF(__pyx_r);
6159 __Pyx_RefNannyFinishContext();
6171 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
6172 PyObject *__pyx_r = NULL;
6173 __Pyx_RefNannyDeclarations
6174 PyObject *__pyx_t_1 = NULL;
6175 int __pyx_lineno = 0;
6176 const char *__pyx_filename = NULL;
6177 int __pyx_clineno = 0;
6178 __Pyx_RefNannySetupContext(
"PyArray_MultiIterNew3", 0);
6187 __Pyx_XDECREF(__pyx_r);
6188 __pyx_t_1 = PyArray_MultiIterNew(3, ((
void *)__pyx_v_a), ((
void *)__pyx_v_b), ((
void *)__pyx_v_c));
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 742, __pyx_L1_error)
6189 __Pyx_GOTREF(__pyx_t_1);
6190 __pyx_r = __pyx_t_1;
6204 __Pyx_XDECREF(__pyx_t_1);
6205 __Pyx_AddTraceback(
"numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
6208 __Pyx_XGIVEREF(__pyx_r);
6209 __Pyx_RefNannyFinishContext();
6221 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) {
6222 PyObject *__pyx_r = NULL;
6223 __Pyx_RefNannyDeclarations
6224 PyObject *__pyx_t_1 = NULL;
6225 int __pyx_lineno = 0;
6226 const char *__pyx_filename = NULL;
6227 int __pyx_clineno = 0;
6228 __Pyx_RefNannySetupContext(
"PyArray_MultiIterNew4", 0);
6237 __Pyx_XDECREF(__pyx_r);
6238 __pyx_t_1 = PyArray_MultiIterNew(4, ((
void *)__pyx_v_a), ((
void *)__pyx_v_b), ((
void *)__pyx_v_c), ((
void *)__pyx_v_d));
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 745, __pyx_L1_error)
6239 __Pyx_GOTREF(__pyx_t_1);
6240 __pyx_r = __pyx_t_1;
6254 __Pyx_XDECREF(__pyx_t_1);
6255 __Pyx_AddTraceback(
"numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
6258 __Pyx_XGIVEREF(__pyx_r);
6259 __Pyx_RefNannyFinishContext();
6271 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) {
6272 PyObject *__pyx_r = NULL;
6273 __Pyx_RefNannyDeclarations
6274 PyObject *__pyx_t_1 = NULL;
6275 int __pyx_lineno = 0;
6276 const char *__pyx_filename = NULL;
6277 int __pyx_clineno = 0;
6278 __Pyx_RefNannySetupContext(
"PyArray_MultiIterNew5", 0);
6287 __Pyx_XDECREF(__pyx_r);
6288 __pyx_t_1 = PyArray_MultiIterNew(5, ((
void *)__pyx_v_a), ((
void *)__pyx_v_b), ((
void *)__pyx_v_c), ((
void *)__pyx_v_d), ((
void *)__pyx_v_e));
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 748, __pyx_L1_error)
6289 __Pyx_GOTREF(__pyx_t_1);
6290 __pyx_r = __pyx_t_1;
6304 __Pyx_XDECREF(__pyx_t_1);
6305 __Pyx_AddTraceback(
"numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
6308 __Pyx_XGIVEREF(__pyx_r);
6309 __Pyx_RefNannyFinishContext();
6321 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
6322 PyObject *__pyx_r = NULL;
6323 __Pyx_RefNannyDeclarations
6325 __Pyx_RefNannySetupContext(
"PyDataType_SHAPE", 0);
6334 __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
6344 __Pyx_XDECREF(__pyx_r);
6345 __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
6346 __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
6366 __Pyx_XDECREF(__pyx_r);
6367 __Pyx_INCREF(__pyx_empty_tuple);
6368 __pyx_r = __pyx_empty_tuple;
6382 __Pyx_XGIVEREF(__pyx_r);
6383 __Pyx_RefNannyFinishContext();
6395 static CYTHON_INLINE
void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
6396 __Pyx_RefNannyDeclarations
6397 __Pyx_RefNannySetupContext(
"set_array_base", 0);
6406 Py_INCREF(__pyx_v_base);
6415 (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));
6426 __Pyx_RefNannyFinishContext();
6437 static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
6438 PyObject *__pyx_v_base;
6439 PyObject *__pyx_r = NULL;
6440 __Pyx_RefNannyDeclarations
6442 __Pyx_RefNannySetupContext(
"get_array_base", 0);
6451 __pyx_v_base = PyArray_BASE(__pyx_v_arr);
6460 __pyx_t_1 = ((__pyx_v_base == NULL) != 0);
6470 __Pyx_XDECREF(__pyx_r);
6471 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6490 __Pyx_XDECREF(__pyx_r);
6491 __Pyx_INCREF(((PyObject *)__pyx_v_base));
6492 __pyx_r = ((PyObject *)__pyx_v_base);
6505 __Pyx_XGIVEREF(__pyx_r);
6506 __Pyx_RefNannyFinishContext();
6518 static CYTHON_INLINE
int __pyx_f_5numpy_import_array(
void) {
6520 __Pyx_RefNannyDeclarations
6521 PyObject *__pyx_t_1 = NULL;
6522 PyObject *__pyx_t_2 = NULL;
6523 PyObject *__pyx_t_3 = NULL;
6525 PyObject *__pyx_t_5 = NULL;
6526 PyObject *__pyx_t_6 = NULL;
6527 PyObject *__pyx_t_7 = NULL;
6528 PyObject *__pyx_t_8 = NULL;
6529 int __pyx_lineno = 0;
6530 const char *__pyx_filename = NULL;
6531 int __pyx_clineno = 0;
6532 __Pyx_RefNannySetupContext(
"import_array", 0);
6542 __Pyx_PyThreadState_declare
6543 __Pyx_PyThreadState_assign
6544 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
6545 __Pyx_XGOTREF(__pyx_t_1);
6546 __Pyx_XGOTREF(__pyx_t_2);
6547 __Pyx_XGOTREF(__pyx_t_3);
6557 __pyx_t_4 = _import_array();
if (unlikely(__pyx_t_4 == ((
int)-1))) __PYX_ERR(2, 943, __pyx_L3_error)
6567 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
6568 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6569 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
6570 goto __pyx_L8_try_end;
6580 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
6582 __Pyx_AddTraceback(
"numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
6583 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 944, __pyx_L5_except_error)
6584 __Pyx_GOTREF(__pyx_t_5);
6585 __Pyx_GOTREF(__pyx_t_6);
6586 __Pyx_GOTREF(__pyx_t_7);
6595 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__6, NULL);
if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 945, __pyx_L5_except_error)
6596 __Pyx_GOTREF(__pyx_t_8);
6597 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
6598 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6599 __PYX_ERR(2, 945, __pyx_L5_except_error)
6601 goto __pyx_L5_except_error;
6602 __pyx_L5_except_error:;
6611 __Pyx_XGIVEREF(__pyx_t_1);
6612 __Pyx_XGIVEREF(__pyx_t_2);
6613 __Pyx_XGIVEREF(__pyx_t_3);
6614 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
6615 goto __pyx_L1_error;
6631 __Pyx_XDECREF(__pyx_t_5);
6632 __Pyx_XDECREF(__pyx_t_6);
6633 __Pyx_XDECREF(__pyx_t_7);
6634 __Pyx_XDECREF(__pyx_t_8);
6635 __Pyx_AddTraceback(
"numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
6638 __Pyx_RefNannyFinishContext();
6650 static CYTHON_INLINE
int __pyx_f_5numpy_import_umath(
void) {
6652 __Pyx_RefNannyDeclarations
6653 PyObject *__pyx_t_1 = NULL;
6654 PyObject *__pyx_t_2 = NULL;
6655 PyObject *__pyx_t_3 = NULL;
6657 PyObject *__pyx_t_5 = NULL;
6658 PyObject *__pyx_t_6 = NULL;
6659 PyObject *__pyx_t_7 = NULL;
6660 PyObject *__pyx_t_8 = NULL;
6661 int __pyx_lineno = 0;
6662 const char *__pyx_filename = NULL;
6663 int __pyx_clineno = 0;
6664 __Pyx_RefNannySetupContext(
"import_umath", 0);
6674 __Pyx_PyThreadState_declare
6675 __Pyx_PyThreadState_assign
6676 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
6677 __Pyx_XGOTREF(__pyx_t_1);
6678 __Pyx_XGOTREF(__pyx_t_2);
6679 __Pyx_XGOTREF(__pyx_t_3);
6689 __pyx_t_4 = _import_umath();
if (unlikely(__pyx_t_4 == ((
int)-1))) __PYX_ERR(2, 949, __pyx_L3_error)
6699 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
6700 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6701 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
6702 goto __pyx_L8_try_end;
6712 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
6714 __Pyx_AddTraceback(
"numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
6715 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 950, __pyx_L5_except_error)
6716 __Pyx_GOTREF(__pyx_t_5);
6717 __Pyx_GOTREF(__pyx_t_6);
6718 __Pyx_GOTREF(__pyx_t_7);
6727 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__7, NULL);
if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 951, __pyx_L5_except_error)
6728 __Pyx_GOTREF(__pyx_t_8);
6729 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
6730 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6731 __PYX_ERR(2, 951, __pyx_L5_except_error)
6733 goto __pyx_L5_except_error;
6734 __pyx_L5_except_error:;
6743 __Pyx_XGIVEREF(__pyx_t_1);
6744 __Pyx_XGIVEREF(__pyx_t_2);
6745 __Pyx_XGIVEREF(__pyx_t_3);
6746 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
6747 goto __pyx_L1_error;
6763 __Pyx_XDECREF(__pyx_t_5);
6764 __Pyx_XDECREF(__pyx_t_6);
6765 __Pyx_XDECREF(__pyx_t_7);
6766 __Pyx_XDECREF(__pyx_t_8);
6767 __Pyx_AddTraceback(
"numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
6770 __Pyx_RefNannyFinishContext();
6782 static CYTHON_INLINE
int __pyx_f_5numpy_import_ufunc(
void) {
6784 __Pyx_RefNannyDeclarations
6785 PyObject *__pyx_t_1 = NULL;
6786 PyObject *__pyx_t_2 = NULL;
6787 PyObject *__pyx_t_3 = NULL;
6789 PyObject *__pyx_t_5 = NULL;
6790 PyObject *__pyx_t_6 = NULL;
6791 PyObject *__pyx_t_7 = NULL;
6792 PyObject *__pyx_t_8 = NULL;
6793 int __pyx_lineno = 0;
6794 const char *__pyx_filename = NULL;
6795 int __pyx_clineno = 0;
6796 __Pyx_RefNannySetupContext(
"import_ufunc", 0);
6806 __Pyx_PyThreadState_declare
6807 __Pyx_PyThreadState_assign
6808 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
6809 __Pyx_XGOTREF(__pyx_t_1);
6810 __Pyx_XGOTREF(__pyx_t_2);
6811 __Pyx_XGOTREF(__pyx_t_3);
6821 __pyx_t_4 = _import_umath();
if (unlikely(__pyx_t_4 == ((
int)-1))) __PYX_ERR(2, 955, __pyx_L3_error)
6831 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
6832 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6833 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
6834 goto __pyx_L8_try_end;
6844 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
6846 __Pyx_AddTraceback(
"numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
6847 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 956, __pyx_L5_except_error)
6848 __Pyx_GOTREF(__pyx_t_5);
6849 __Pyx_GOTREF(__pyx_t_6);
6850 __Pyx_GOTREF(__pyx_t_7);
6859 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__7, NULL);
if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 957, __pyx_L5_except_error)
6860 __Pyx_GOTREF(__pyx_t_8);
6861 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
6862 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6863 __PYX_ERR(2, 957, __pyx_L5_except_error)
6865 goto __pyx_L5_except_error;
6866 __pyx_L5_except_error:;
6875 __Pyx_XGIVEREF(__pyx_t_1);
6876 __Pyx_XGIVEREF(__pyx_t_2);
6877 __Pyx_XGIVEREF(__pyx_t_3);
6878 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
6879 goto __pyx_L1_error;
6895 __Pyx_XDECREF(__pyx_t_5);
6896 __Pyx_XDECREF(__pyx_t_6);
6897 __Pyx_XDECREF(__pyx_t_7);
6898 __Pyx_XDECREF(__pyx_t_8);
6899 __Pyx_AddTraceback(
"numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
6902 __Pyx_RefNannyFinishContext();
6914 static CYTHON_INLINE
int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) {
6916 __Pyx_RefNannyDeclarations
6917 __Pyx_RefNannySetupContext(
"is_timedelta64_object", 0);
6926 __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type));
6939 __Pyx_RefNannyFinishContext();
6951 static CYTHON_INLINE
int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) {
6953 __Pyx_RefNannyDeclarations
6954 __Pyx_RefNannySetupContext(
"is_datetime64_object", 0);
6963 __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type));
6976 __Pyx_RefNannyFinishContext();
6988 static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) {
6989 npy_datetime __pyx_r;
6998 __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval;
7022 static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) {
7023 npy_timedelta __pyx_r;
7032 __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval;
7056 static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) {
7057 NPY_DATETIMEUNIT __pyx_r;
7064 __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base);
7089 static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
7090 static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7091 PyObject *__pyx_v_shape = 0;
7092 Py_ssize_t __pyx_v_itemsize;
7093 PyObject *__pyx_v_format = 0;
7094 PyObject *__pyx_v_mode = 0;
7095 int __pyx_v_allocate_buffer;
7096 int __pyx_lineno = 0;
7097 const char *__pyx_filename = NULL;
7098 int __pyx_clineno = 0;
7100 __Pyx_RefNannyDeclarations
7101 __Pyx_RefNannySetupContext(
"__cinit__ (wrapper)", 0);
7103 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shape,&__pyx_n_s_itemsize,&__pyx_n_s_format,&__pyx_n_s_mode,&__pyx_n_s_allocate_buffer,0};
7104 PyObject* values[5] = {0,0,0,0,0};
7105 values[3] = ((PyObject *)__pyx_n_s_c);
7106 if (unlikely(__pyx_kwds)) {
7108 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7110 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7112 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7114 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7116 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7118 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7121 default:
goto __pyx_L5_argtuple_error;
7123 kw_args = PyDict_Size(__pyx_kwds);
7126 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--;
7127 else goto __pyx_L5_argtuple_error;
7130 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--;
7132 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 0, 3, 5, 1); __PYX_ERR(1, 122, __pyx_L3_error)
7136 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--;
7138 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 0, 3, 5, 2); __PYX_ERR(1, 122, __pyx_L3_error)
7143 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode);
7144 if (value) { values[3] = value; kw_args--; }
7149 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allocate_buffer);
7150 if (value) { values[4] = value; kw_args--; }
7153 if (unlikely(kw_args > 0)) {
7154 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__cinit__") < 0)) __PYX_ERR(1, 122, __pyx_L3_error)
7157 switch (PyTuple_GET_SIZE(__pyx_args)) {
7158 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7160 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7162 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7163 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7164 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7166 default:
goto __pyx_L5_argtuple_error;
7169 __pyx_v_shape = ((PyObject*)values[0]);
7170 __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]);
if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 122, __pyx_L3_error)
7171 __pyx_v_format = values[2];
7172 __pyx_v_mode = values[3];
7174 __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]);
if (unlikely((__pyx_v_allocate_buffer == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 123, __pyx_L3_error)
7184 __pyx_v_allocate_buffer = ((int)1);
7187 goto __pyx_L4_argument_unpacking_done;
7188 __pyx_L5_argtuple_error:;
7189 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 122, __pyx_L3_error)
7191 __Pyx_AddTraceback(
"View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7192 __Pyx_RefNannyFinishContext();
7194 __pyx_L4_argument_unpacking_done:;
7195 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1,
"shape", 1))) __PYX_ERR(1, 122, __pyx_L1_error)
7196 if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) {
7197 PyErr_Format(PyExc_TypeError,
"Argument '%.200s' must not be None",
"format"); __PYX_ERR(1, 122, __pyx_L1_error)
7199 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((
struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer);
7214 __Pyx_RefNannyFinishContext();
7218 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode,
int __pyx_v_allocate_buffer) {
7220 Py_ssize_t __pyx_v_i;
7221 Py_ssize_t __pyx_v_dim;
7222 PyObject **__pyx_v_p;
7225 __Pyx_RefNannyDeclarations
7226 Py_ssize_t __pyx_t_1;
7228 PyObject *__pyx_t_3 = NULL;
7230 PyObject *__pyx_t_5 = NULL;
7231 PyObject *__pyx_t_6 = NULL;
7234 Py_ssize_t __pyx_t_9;
7235 PyObject *__pyx_t_10 = NULL;
7236 Py_ssize_t __pyx_t_11;
7237 int __pyx_lineno = 0;
7238 const char *__pyx_filename = NULL;
7239 int __pyx_clineno = 0;
7240 __Pyx_RefNannySetupContext(
"__cinit__", 0);
7241 __Pyx_INCREF(__pyx_v_format);
7250 if (unlikely(__pyx_v_shape == Py_None)) {
7251 PyErr_SetString(PyExc_TypeError,
"object of type 'NoneType' has no len()");
7252 __PYX_ERR(1, 129, __pyx_L1_error)
7254 __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_shape);
if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 129, __pyx_L1_error)
7255 __pyx_v_self->ndim = ((int)__pyx_t_1);
7264 __pyx_v_self->itemsize = __pyx_v_itemsize;
7273 __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0);
7274 if (unlikely(__pyx_t_2)) {
7283 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__8, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 133, __pyx_L1_error)
7284 __Pyx_GOTREF(__pyx_t_3);
7285 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
7286 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7287 __PYX_ERR(1, 133, __pyx_L1_error)
7305 __pyx_t_2 = ((__pyx_v_itemsize <= 0) != 0);
7306 if (unlikely(__pyx_t_2)) {
7315 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 136, __pyx_L1_error)
7316 __Pyx_GOTREF(__pyx_t_3);
7317 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
7318 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7319 __PYX_ERR(1, 136, __pyx_L1_error)
7337 __pyx_t_2 = PyBytes_Check(__pyx_v_format);
7338 __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0);
7348 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 139, __pyx_L1_error)
7349 __Pyx_GOTREF(__pyx_t_5);
7351 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
7352 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
7353 if (likely(__pyx_t_6)) {
7354 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_5);
7355 __Pyx_INCREF(__pyx_t_6);
7356 __Pyx_INCREF(
function);
7357 __Pyx_DECREF_SET(__pyx_t_5,
function);
7360 __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_n_s_ASCII) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_s_ASCII);
7361 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7362 if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 139, __pyx_L1_error)
7363 __Pyx_GOTREF(__pyx_t_3);
7364 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7365 __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3);
7384 if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None)||(PyErr_Format(PyExc_TypeError,
"Expected %.16s, got %.200s",
"bytes", Py_TYPE(__pyx_v_format)->tp_name), 0))) __PYX_ERR(1, 140, __pyx_L1_error)
7385 __pyx_t_3 = __pyx_v_format;
7386 __Pyx_INCREF(__pyx_t_3);
7387 __Pyx_GIVEREF(__pyx_t_3);
7388 __Pyx_GOTREF(__pyx_v_self->_format);
7389 __Pyx_DECREF(__pyx_v_self->_format);
7390 __pyx_v_self->_format = ((PyObject*)__pyx_t_3);
7400 if (unlikely(__pyx_v_self->_format == Py_None)) {
7401 PyErr_SetString(PyExc_TypeError,
"expected bytes, NoneType found");
7402 __PYX_ERR(1, 141, __pyx_L1_error)
7404 __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format);
if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(1, 141, __pyx_L1_error)
7405 __pyx_v_self->format = __pyx_t_7;
7414 __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((
sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2)));
7423 __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim);
7432 __pyx_t_4 = ((!(__pyx_v_self->_shape != 0)) != 0);
7433 if (unlikely(__pyx_t_4)) {
7442 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__10, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 148, __pyx_L1_error)
7443 __Pyx_GOTREF(__pyx_t_3);
7444 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
7445 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7446 __PYX_ERR(1, 148, __pyx_L1_error)
7465 __pyx_t_3 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
7467 if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3))
break;
7468 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7469 __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++;
if (unlikely(0 < 0)) __PYX_ERR(1, 151, __pyx_L1_error)
7471 __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++;
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 151, __pyx_L1_error)
7472 __Pyx_GOTREF(__pyx_t_5);
7474 __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5);
if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 151, __pyx_L1_error)
7475 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7476 __pyx_v_dim = __pyx_t_9;
7477 __pyx_v_idx = __pyx_t_8;
7478 __pyx_t_8 = (__pyx_t_8 + 1);
7487 __pyx_t_4 = ((__pyx_v_dim <= 0) != 0);
7488 if (unlikely(__pyx_t_4)) {
7497 __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 153, __pyx_L1_error)
7498 __Pyx_GOTREF(__pyx_t_5);
7499 __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_dim);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 153, __pyx_L1_error)
7500 __Pyx_GOTREF(__pyx_t_6);
7501 __pyx_t_10 = PyTuple_New(2);
if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 153, __pyx_L1_error)
7502 __Pyx_GOTREF(__pyx_t_10);
7503 __Pyx_GIVEREF(__pyx_t_5);
7504 PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5);
7505 __Pyx_GIVEREF(__pyx_t_6);
7506 PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6);
7509 __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_t_10);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 153, __pyx_L1_error)
7510 __Pyx_GOTREF(__pyx_t_6);
7511 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7512 __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6);
if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 153, __pyx_L1_error)
7513 __Pyx_GOTREF(__pyx_t_10);
7514 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7515 __Pyx_Raise(__pyx_t_10, 0, 0, 0);
7516 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7517 __PYX_ERR(1, 153, __pyx_L1_error)
7535 (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim;
7545 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7554 __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ));
if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 157, __pyx_L1_error)
7564 __pyx_v_order =
'F';
7573 __Pyx_INCREF(__pyx_n_u_fortran);
7574 __Pyx_GIVEREF(__pyx_n_u_fortran);
7575 __Pyx_GOTREF(__pyx_v_self->mode);
7576 __Pyx_DECREF(__pyx_v_self->mode);
7577 __pyx_v_self->mode = __pyx_n_u_fortran;
7596 __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ));
if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 160, __pyx_L1_error)
7597 if (likely(__pyx_t_4)) {
7606 __pyx_v_order =
'C';
7615 __Pyx_INCREF(__pyx_n_u_c);
7616 __Pyx_GIVEREF(__pyx_n_u_c);
7617 __Pyx_GOTREF(__pyx_v_self->mode);
7618 __Pyx_DECREF(__pyx_v_self->mode);
7619 __pyx_v_self->mode = __pyx_n_u_c;
7639 __pyx_t_3 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_v_mode);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 164, __pyx_L1_error)
7640 __Pyx_GOTREF(__pyx_t_3);
7641 __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3);
if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 164, __pyx_L1_error)
7642 __Pyx_GOTREF(__pyx_t_10);
7643 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7644 __Pyx_Raise(__pyx_t_10, 0, 0, 0);
7645 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7646 __PYX_ERR(1, 164, __pyx_L1_error)
7657 __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order);
7666 __pyx_v_self->free_data = __pyx_v_allocate_buffer;
7675 __pyx_t_10 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_10);
if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 170, __pyx_L1_error)
7676 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10);
if (unlikely((__pyx_t_4 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 170, __pyx_L1_error)
7677 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7678 __pyx_v_self->dtype_is_object = __pyx_t_4;
7687 __pyx_t_4 = (__pyx_v_allocate_buffer != 0);
7697 __pyx_v_self->data = ((
char *)malloc(__pyx_v_self->len));
7706 __pyx_t_4 = ((!(__pyx_v_self->data != 0)) != 0);
7707 if (unlikely(__pyx_t_4)) {
7716 __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__11, NULL);
if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 176, __pyx_L1_error)
7717 __Pyx_GOTREF(__pyx_t_10);
7718 __Pyx_Raise(__pyx_t_10, 0, 0, 0);
7719 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7720 __PYX_ERR(1, 176, __pyx_L1_error)
7738 __pyx_t_4 = (__pyx_v_self->dtype_is_object != 0);
7748 __pyx_v_p = ((PyObject **)__pyx_v_self->data);
7757 if (unlikely(__pyx_v_itemsize == 0)) {
7758 PyErr_SetString(PyExc_ZeroDivisionError,
"integer division or modulo by zero");
7759 __PYX_ERR(1, 180, __pyx_L1_error)
7761 else if (
sizeof(Py_ssize_t) ==
sizeof(
long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) {
7762 PyErr_SetString(PyExc_OverflowError,
"value too large to perform division");
7763 __PYX_ERR(1, 180, __pyx_L1_error)
7765 __pyx_t_1 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_itemsize);
7766 __pyx_t_9 = __pyx_t_1;
7767 for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
7768 __pyx_v_i = __pyx_t_11;
7777 (__pyx_v_p[__pyx_v_i]) = Py_None;
7819 __Pyx_XDECREF(__pyx_t_3);
7820 __Pyx_XDECREF(__pyx_t_5);
7821 __Pyx_XDECREF(__pyx_t_6);
7822 __Pyx_XDECREF(__pyx_t_10);
7823 __Pyx_AddTraceback(
"View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7826 __Pyx_XDECREF(__pyx_v_format);
7827 __Pyx_RefNannyFinishContext();
7840 static CYTHON_UNUSED
int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
7841 static CYTHON_UNUSED
int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags) {
7843 __Pyx_RefNannyDeclarations
7844 __Pyx_RefNannySetupContext(
"__getbuffer__ (wrapper)", 0);
7845 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((
struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((
int)__pyx_v_flags));
7848 __Pyx_RefNannyFinishContext();
7852 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(
struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags) {
7853 int __pyx_v_bufmode;
7855 __Pyx_RefNannyDeclarations
7858 PyObject *__pyx_t_3 = NULL;
7860 Py_ssize_t __pyx_t_5;
7862 Py_ssize_t *__pyx_t_7;
7863 int __pyx_lineno = 0;
7864 const char *__pyx_filename = NULL;
7865 int __pyx_clineno = 0;
7866 if (__pyx_v_info == NULL) {
7867 PyErr_SetString(PyExc_BufferError,
"PyObject_GetBuffer: view==NULL argument is obsolete");
7870 __Pyx_RefNannySetupContext(
"__getbuffer__", 0);
7871 __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
7872 __Pyx_GIVEREF(__pyx_v_info->obj);
7881 __pyx_v_bufmode = -1;
7890 __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ));
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 187, __pyx_L1_error)
7891 __pyx_t_2 = (__pyx_t_1 != 0);
7901 __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
7920 __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ));
if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 189, __pyx_L1_error)
7921 __pyx_t_1 = (__pyx_t_2 != 0);
7931 __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
7950 __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0);
7951 if (unlikely(__pyx_t_1)) {
7960 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__12, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 192, __pyx_L1_error)
7961 __Pyx_GOTREF(__pyx_t_3);
7962 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
7963 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7964 __PYX_ERR(1, 192, __pyx_L1_error)
7982 __pyx_t_4 = __pyx_v_self->data;
7983 __pyx_v_info->buf = __pyx_t_4;
7992 __pyx_t_5 = __pyx_v_self->len;
7993 __pyx_v_info->len = __pyx_t_5;
8002 __pyx_t_6 = __pyx_v_self->ndim;
8003 __pyx_v_info->ndim = __pyx_t_6;
8012 __pyx_t_7 = __pyx_v_self->_shape;
8013 __pyx_v_info->shape = __pyx_t_7;
8022 __pyx_t_7 = __pyx_v_self->_strides;
8023 __pyx_v_info->strides = __pyx_t_7;
8032 __pyx_v_info->suboffsets = NULL;
8041 __pyx_t_5 = __pyx_v_self->itemsize;
8042 __pyx_v_info->itemsize = __pyx_t_5;
8051 __pyx_v_info->readonly = 0;
8060 __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
8070 __pyx_t_4 = __pyx_v_self->format;
8071 __pyx_v_info->format = __pyx_t_4;
8091 __pyx_v_info->format = NULL;
8102 __Pyx_INCREF(((PyObject *)__pyx_v_self));
8103 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
8104 __Pyx_GOTREF(__pyx_v_info->obj);
8105 __Pyx_DECREF(__pyx_v_info->obj);
8106 __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
8120 __Pyx_XDECREF(__pyx_t_3);
8121 __Pyx_AddTraceback(
"View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8123 if (__pyx_v_info->obj != NULL) {
8124 __Pyx_GOTREF(__pyx_v_info->obj);
8125 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
8129 if (__pyx_v_info->obj == Py_None) {
8130 __Pyx_GOTREF(__pyx_v_info->obj);
8131 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
8134 __Pyx_RefNannyFinishContext();
8147 static void __pyx_array___dealloc__(PyObject *__pyx_v_self);
8148 static void __pyx_array___dealloc__(PyObject *__pyx_v_self) {
8149 __Pyx_RefNannyDeclarations
8150 __Pyx_RefNannySetupContext(
"__dealloc__ (wrapper)", 0);
8151 __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((
struct __pyx_array_obj *)__pyx_v_self));
8154 __Pyx_RefNannyFinishContext();
8157 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(
struct __pyx_array_obj *__pyx_v_self) {
8158 __Pyx_RefNannyDeclarations
8160 __Pyx_RefNannySetupContext(
"__dealloc__", 0);
8169 __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0);
8179 __pyx_v_self->callback_free_data(__pyx_v_self->data);
8198 __pyx_t_1 = (__pyx_v_self->free_data != 0);
8208 __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
8218 __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0);
8236 free(__pyx_v_self->data);
8255 PyObject_Free(__pyx_v_self->_shape);
8266 __Pyx_RefNannyFinishContext();
8278 static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self);
8279 static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) {
8280 PyObject *__pyx_r = 0;
8281 __Pyx_RefNannyDeclarations
8282 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
8283 __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((
struct __pyx_array_obj *)__pyx_v_self));
8286 __Pyx_RefNannyFinishContext();
8290 static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(
struct __pyx_array_obj *__pyx_v_self) {
8291 PyObject *__pyx_r = NULL;
8292 __Pyx_RefNannyDeclarations
8293 PyObject *__pyx_t_1 = NULL;
8294 int __pyx_lineno = 0;
8295 const char *__pyx_filename = NULL;
8296 int __pyx_clineno = 0;
8297 __Pyx_RefNannySetupContext(
"__get__", 0);
8306 __Pyx_XDECREF(__pyx_r);
8307 __pyx_t_1 = ((
struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 223, __pyx_L1_error)
8308 __Pyx_GOTREF(__pyx_t_1);
8309 __pyx_r = __pyx_t_1;
8323 __Pyx_XDECREF(__pyx_t_1);
8324 __Pyx_AddTraceback(
"View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8327 __Pyx_XGIVEREF(__pyx_r);
8328 __Pyx_RefNannyFinishContext();
8340 static PyObject *__pyx_array_get_memview(
struct __pyx_array_obj *__pyx_v_self) {
8342 PyObject *__pyx_r = NULL;
8343 __Pyx_RefNannyDeclarations
8344 PyObject *__pyx_t_1 = NULL;
8345 PyObject *__pyx_t_2 = NULL;
8346 PyObject *__pyx_t_3 = NULL;
8347 int __pyx_lineno = 0;
8348 const char *__pyx_filename = NULL;
8349 int __pyx_clineno = 0;
8350 __Pyx_RefNannySetupContext(
"get_memview", 0);
8359 __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE);
8368 __Pyx_XDECREF(__pyx_r);
8369 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 228, __pyx_L1_error)
8370 __Pyx_GOTREF(__pyx_t_1);
8371 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 228, __pyx_L1_error)
8372 __Pyx_GOTREF(__pyx_t_2);
8373 __pyx_t_3 = PyTuple_New(3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 228, __pyx_L1_error)
8374 __Pyx_GOTREF(__pyx_t_3);
8375 __Pyx_INCREF(((PyObject *)__pyx_v_self));
8376 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
8377 PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self));
8378 __Pyx_GIVEREF(__pyx_t_1);
8379 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
8380 __Pyx_GIVEREF(__pyx_t_2);
8381 PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
8384 __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 228, __pyx_L1_error)
8385 __Pyx_GOTREF(__pyx_t_2);
8386 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8387 __pyx_r = __pyx_t_2;
8401 __Pyx_XDECREF(__pyx_t_1);
8402 __Pyx_XDECREF(__pyx_t_2);
8403 __Pyx_XDECREF(__pyx_t_3);
8404 __Pyx_AddTraceback(
"View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
8407 __Pyx_XGIVEREF(__pyx_r);
8408 __Pyx_RefNannyFinishContext();
8421 static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self);
8422 static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) {
8424 __Pyx_RefNannyDeclarations
8425 __Pyx_RefNannySetupContext(
"__len__ (wrapper)", 0);
8426 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((
struct __pyx_array_obj *)__pyx_v_self));
8429 __Pyx_RefNannyFinishContext();
8433 static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(
struct __pyx_array_obj *__pyx_v_self) {
8435 __Pyx_RefNannyDeclarations
8436 __Pyx_RefNannySetupContext(
"__len__", 0);
8445 __pyx_r = (__pyx_v_self->_shape[0]);
8458 __Pyx_RefNannyFinishContext();
8471 static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr);
8472 static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) {
8473 PyObject *__pyx_r = 0;
8474 __Pyx_RefNannyDeclarations
8475 __Pyx_RefNannySetupContext(
"__getattr__ (wrapper)", 0);
8476 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((
struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr));
8479 __Pyx_RefNannyFinishContext();
8483 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) {
8484 PyObject *__pyx_r = NULL;
8485 __Pyx_RefNannyDeclarations
8486 PyObject *__pyx_t_1 = NULL;
8487 PyObject *__pyx_t_2 = NULL;
8488 int __pyx_lineno = 0;
8489 const char *__pyx_filename = NULL;
8490 int __pyx_clineno = 0;
8491 __Pyx_RefNannySetupContext(
"__getattr__", 0);
8500 __Pyx_XDECREF(__pyx_r);
8501 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 234, __pyx_L1_error)
8502 __Pyx_GOTREF(__pyx_t_1);
8503 __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 234, __pyx_L1_error)
8504 __Pyx_GOTREF(__pyx_t_2);
8505 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8506 __pyx_r = __pyx_t_2;
8520 __Pyx_XDECREF(__pyx_t_1);
8521 __Pyx_XDECREF(__pyx_t_2);
8522 __Pyx_AddTraceback(
"View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8525 __Pyx_XGIVEREF(__pyx_r);
8526 __Pyx_RefNannyFinishContext();
8539 static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item);
8540 static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
8541 PyObject *__pyx_r = 0;
8542 __Pyx_RefNannyDeclarations
8543 __Pyx_RefNannySetupContext(
"__getitem__ (wrapper)", 0);
8544 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((
struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item));
8547 __Pyx_RefNannyFinishContext();
8551 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) {
8552 PyObject *__pyx_r = NULL;
8553 __Pyx_RefNannyDeclarations
8554 PyObject *__pyx_t_1 = NULL;
8555 PyObject *__pyx_t_2 = NULL;
8556 int __pyx_lineno = 0;
8557 const char *__pyx_filename = NULL;
8558 int __pyx_clineno = 0;
8559 __Pyx_RefNannySetupContext(
"__getitem__", 0);
8568 __Pyx_XDECREF(__pyx_r);
8569 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 237, __pyx_L1_error)
8570 __Pyx_GOTREF(__pyx_t_1);
8571 __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 237, __pyx_L1_error)
8572 __Pyx_GOTREF(__pyx_t_2);
8573 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8574 __pyx_r = __pyx_t_2;
8588 __Pyx_XDECREF(__pyx_t_1);
8589 __Pyx_XDECREF(__pyx_t_2);
8590 __Pyx_AddTraceback(
"View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8593 __Pyx_XGIVEREF(__pyx_r);
8594 __Pyx_RefNannyFinishContext();
8607 static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value);
8608 static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
8610 __Pyx_RefNannyDeclarations
8611 __Pyx_RefNannySetupContext(
"__setitem__ (wrapper)", 0);
8612 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((
struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value));
8615 __Pyx_RefNannyFinishContext();
8619 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
8621 __Pyx_RefNannyDeclarations
8622 PyObject *__pyx_t_1 = NULL;
8623 int __pyx_lineno = 0;
8624 const char *__pyx_filename = NULL;
8625 int __pyx_clineno = 0;
8626 __Pyx_RefNannySetupContext(
"__setitem__", 0);
8635 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 240, __pyx_L1_error)
8636 __Pyx_GOTREF(__pyx_t_1);
8637 if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0)) __PYX_ERR(1, 240, __pyx_L1_error)
8638 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8652 __Pyx_XDECREF(__pyx_t_1);
8653 __Pyx_AddTraceback(
"View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8656 __Pyx_RefNannyFinishContext();
8667 static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
8668 static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
8669 PyObject *__pyx_r = 0;
8670 __Pyx_RefNannyDeclarations
8671 __Pyx_RefNannySetupContext(
"__reduce_cython__ (wrapper)", 0);
8672 __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((
struct __pyx_array_obj *)__pyx_v_self));
8675 __Pyx_RefNannyFinishContext();
8679 static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED
struct __pyx_array_obj *__pyx_v_self) {
8680 PyObject *__pyx_r = NULL;
8681 __Pyx_RefNannyDeclarations
8682 PyObject *__pyx_t_1 = NULL;
8683 int __pyx_lineno = 0;
8684 const char *__pyx_filename = NULL;
8685 int __pyx_clineno = 0;
8686 __Pyx_RefNannySetupContext(
"__reduce_cython__", 0);
8694 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__13, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
8695 __Pyx_GOTREF(__pyx_t_1);
8696 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
8697 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8698 __PYX_ERR(1, 2, __pyx_L1_error)
8708 __Pyx_XDECREF(__pyx_t_1);
8709 __Pyx_AddTraceback(
"View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8711 __Pyx_XGIVEREF(__pyx_r);
8712 __Pyx_RefNannyFinishContext();
8724 static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state);
8725 static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
8726 PyObject *__pyx_r = 0;
8727 __Pyx_RefNannyDeclarations
8728 __Pyx_RefNannySetupContext(
"__setstate_cython__ (wrapper)", 0);
8729 __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((
struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
8732 __Pyx_RefNannyFinishContext();
8736 static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
8737 PyObject *__pyx_r = NULL;
8738 __Pyx_RefNannyDeclarations
8739 PyObject *__pyx_t_1 = NULL;
8740 int __pyx_lineno = 0;
8741 const char *__pyx_filename = NULL;
8742 int __pyx_clineno = 0;
8743 __Pyx_RefNannySetupContext(
"__setstate_cython__", 0);
8750 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__14, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
8751 __Pyx_GOTREF(__pyx_t_1);
8752 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
8753 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8754 __PYX_ERR(1, 4, __pyx_L1_error)
8765 __Pyx_XDECREF(__pyx_t_1);
8766 __Pyx_AddTraceback(
"View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8768 __Pyx_XGIVEREF(__pyx_r);
8769 __Pyx_RefNannyFinishContext();
8781 static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize,
char *__pyx_v_format,
char *__pyx_v_mode,
char *__pyx_v_buf) {
8782 struct __pyx_array_obj *__pyx_v_result = 0;
8783 struct __pyx_array_obj *__pyx_r = NULL;
8784 __Pyx_RefNannyDeclarations
8786 PyObject *__pyx_t_2 = NULL;
8787 PyObject *__pyx_t_3 = NULL;
8788 PyObject *__pyx_t_4 = NULL;
8789 PyObject *__pyx_t_5 = NULL;
8790 int __pyx_lineno = 0;
8791 const char *__pyx_filename = NULL;
8792 int __pyx_clineno = 0;
8793 __Pyx_RefNannySetupContext(
"array_cwrapper", 0);
8802 __pyx_t_1 = ((__pyx_v_buf == NULL) != 0);
8812 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 249, __pyx_L1_error)
8813 __Pyx_GOTREF(__pyx_t_2);
8814 __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 249, __pyx_L1_error)
8815 __Pyx_GOTREF(__pyx_t_3);
8816 __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 249, __pyx_L1_error)
8817 __Pyx_GOTREF(__pyx_t_4);
8818 __pyx_t_5 = PyTuple_New(4);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 249, __pyx_L1_error)
8819 __Pyx_GOTREF(__pyx_t_5);
8820 __Pyx_INCREF(__pyx_v_shape);
8821 __Pyx_GIVEREF(__pyx_v_shape);
8822 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_shape);
8823 __Pyx_GIVEREF(__pyx_t_2);
8824 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
8825 __Pyx_GIVEREF(__pyx_t_3);
8826 PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
8827 __Pyx_GIVEREF(__pyx_t_4);
8828 PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
8832 __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_5, NULL);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 249, __pyx_L1_error)
8833 __Pyx_GOTREF(__pyx_t_4);
8834 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8835 __pyx_v_result = ((
struct __pyx_array_obj *)__pyx_t_4);
8856 __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 251, __pyx_L1_error)
8857 __Pyx_GOTREF(__pyx_t_4);
8858 __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 251, __pyx_L1_error)
8859 __Pyx_GOTREF(__pyx_t_5);
8860 __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 251, __pyx_L1_error)
8861 __Pyx_GOTREF(__pyx_t_3);
8862 __pyx_t_2 = PyTuple_New(4);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 251, __pyx_L1_error)
8863 __Pyx_GOTREF(__pyx_t_2);
8864 __Pyx_INCREF(__pyx_v_shape);
8865 __Pyx_GIVEREF(__pyx_v_shape);
8866 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape);
8867 __Pyx_GIVEREF(__pyx_t_4);
8868 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
8869 __Pyx_GIVEREF(__pyx_t_5);
8870 PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
8871 __Pyx_GIVEREF(__pyx_t_3);
8872 PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3);
8884 __pyx_t_3 = __Pyx_PyDict_NewPresized(1);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 252, __pyx_L1_error)
8885 __Pyx_GOTREF(__pyx_t_3);
8886 if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(1, 252, __pyx_L1_error)
8895 __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_2, __pyx_t_3);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 251, __pyx_L1_error)
8896 __Pyx_GOTREF(__pyx_t_5);
8897 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8898 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8899 __pyx_v_result = ((
struct __pyx_array_obj *)__pyx_t_5);
8909 __pyx_v_result->data = __pyx_v_buf;
8920 __Pyx_XDECREF(((PyObject *)__pyx_r));
8921 __Pyx_INCREF(((PyObject *)__pyx_v_result));
8922 __pyx_r = __pyx_v_result;
8935 __Pyx_XDECREF(__pyx_t_2);
8936 __Pyx_XDECREF(__pyx_t_3);
8937 __Pyx_XDECREF(__pyx_t_4);
8938 __Pyx_XDECREF(__pyx_t_5);
8939 __Pyx_AddTraceback(
"View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
8942 __Pyx_XDECREF((PyObject *)__pyx_v_result);
8943 __Pyx_XGIVEREF((PyObject *)__pyx_r);
8944 __Pyx_RefNannyFinishContext();
8957 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
8958 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8959 PyObject *__pyx_v_name = 0;
8960 int __pyx_lineno = 0;
8961 const char *__pyx_filename = NULL;
8962 int __pyx_clineno = 0;
8964 __Pyx_RefNannyDeclarations
8965 __Pyx_RefNannySetupContext(
"__init__ (wrapper)", 0);
8967 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0};
8968 PyObject* values[1] = {0};
8969 if (unlikely(__pyx_kwds)) {
8971 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8973 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8976 default:
goto __pyx_L5_argtuple_error;
8978 kw_args = PyDict_Size(__pyx_kwds);
8981 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
8982 else goto __pyx_L5_argtuple_error;
8984 if (unlikely(kw_args > 0)) {
8985 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__init__") < 0)) __PYX_ERR(1, 281, __pyx_L3_error)
8987 }
else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
8988 goto __pyx_L5_argtuple_error;
8990 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8992 __pyx_v_name = values[0];
8994 goto __pyx_L4_argument_unpacking_done;
8995 __pyx_L5_argtuple_error:;
8996 __Pyx_RaiseArgtupleInvalid(
"__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 281, __pyx_L3_error)
8998 __Pyx_AddTraceback(
"View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8999 __Pyx_RefNannyFinishContext();
9001 __pyx_L4_argument_unpacking_done:;
9002 __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((
struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name);
9005 __Pyx_RefNannyFinishContext();
9009 static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(
struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) {
9011 __Pyx_RefNannyDeclarations
9012 __Pyx_RefNannySetupContext(
"__init__", 0);
9021 __Pyx_INCREF(__pyx_v_name);
9022 __Pyx_GIVEREF(__pyx_v_name);
9023 __Pyx_GOTREF(__pyx_v_self->name);
9024 __Pyx_DECREF(__pyx_v_self->name);
9025 __pyx_v_self->name = __pyx_v_name;
9037 __Pyx_RefNannyFinishContext();
9050 static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self);
9051 static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) {
9052 PyObject *__pyx_r = 0;
9053 __Pyx_RefNannyDeclarations
9054 __Pyx_RefNannySetupContext(
"__repr__ (wrapper)", 0);
9055 __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((
struct __pyx_MemviewEnum_obj *)__pyx_v_self));
9058 __Pyx_RefNannyFinishContext();
9062 static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(
struct __pyx_MemviewEnum_obj *__pyx_v_self) {
9063 PyObject *__pyx_r = NULL;
9064 __Pyx_RefNannyDeclarations
9065 __Pyx_RefNannySetupContext(
"__repr__", 0);
9074 __Pyx_XDECREF(__pyx_r);
9075 __Pyx_INCREF(__pyx_v_self->name);
9076 __pyx_r = __pyx_v_self->name;
9089 __Pyx_XGIVEREF(__pyx_r);
9090 __Pyx_RefNannyFinishContext();
9101 static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
9102 static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
9103 PyObject *__pyx_r = 0;
9104 __Pyx_RefNannyDeclarations
9105 __Pyx_RefNannySetupContext(
"__reduce_cython__ (wrapper)", 0);
9106 __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((
struct __pyx_MemviewEnum_obj *)__pyx_v_self));
9109 __Pyx_RefNannyFinishContext();
9113 static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(
struct __pyx_MemviewEnum_obj *__pyx_v_self) {
9114 PyObject *__pyx_v_state = 0;
9115 PyObject *__pyx_v__dict = 0;
9116 int __pyx_v_use_setstate;
9117 PyObject *__pyx_r = NULL;
9118 __Pyx_RefNannyDeclarations
9119 PyObject *__pyx_t_1 = NULL;
9122 PyObject *__pyx_t_4 = NULL;
9123 PyObject *__pyx_t_5 = NULL;
9124 int __pyx_lineno = 0;
9125 const char *__pyx_filename = NULL;
9126 int __pyx_clineno = 0;
9127 __Pyx_RefNannySetupContext(
"__reduce_cython__", 0);
9136 __pyx_t_1 = PyTuple_New(1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
9137 __Pyx_GOTREF(__pyx_t_1);
9138 __Pyx_INCREF(__pyx_v_self->name);
9139 __Pyx_GIVEREF(__pyx_v_self->name);
9140 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name);
9141 __pyx_v_state = ((PyObject*)__pyx_t_1);
9151 __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error)
9152 __Pyx_GOTREF(__pyx_t_1);
9153 __pyx_v__dict = __pyx_t_1;
9163 __pyx_t_2 = (__pyx_v__dict != Py_None);
9164 __pyx_t_3 = (__pyx_t_2 != 0);
9174 __pyx_t_1 = PyTuple_New(1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
9175 __Pyx_GOTREF(__pyx_t_1);
9176 __Pyx_INCREF(__pyx_v__dict);
9177 __Pyx_GIVEREF(__pyx_v__dict);
9178 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
9179 __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
9180 __Pyx_GOTREF(__pyx_t_4);
9181 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9182 __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
9192 __pyx_v_use_setstate = 1;
9212 __pyx_t_3 = (__pyx_v_self->name != Py_None);
9213 __pyx_v_use_setstate = __pyx_t_3;
9224 __pyx_t_3 = (__pyx_v_use_setstate != 0);
9234 __Pyx_XDECREF(__pyx_r);
9235 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
9236 __Pyx_GOTREF(__pyx_t_4);
9237 __pyx_t_1 = PyTuple_New(3);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
9238 __Pyx_GOTREF(__pyx_t_1);
9239 __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
9240 __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
9241 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
9242 __Pyx_INCREF(__pyx_int_184977713);
9243 __Pyx_GIVEREF(__pyx_int_184977713);
9244 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
9245 __Pyx_INCREF(Py_None);
9246 __Pyx_GIVEREF(Py_None);
9247 PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
9248 __pyx_t_5 = PyTuple_New(3);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
9249 __Pyx_GOTREF(__pyx_t_5);
9250 __Pyx_GIVEREF(__pyx_t_4);
9251 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
9252 __Pyx_GIVEREF(__pyx_t_1);
9253 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
9254 __Pyx_INCREF(__pyx_v_state);
9255 __Pyx_GIVEREF(__pyx_v_state);
9256 PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
9259 __pyx_r = __pyx_t_5;
9280 __Pyx_XDECREF(__pyx_r);
9281 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_Enum);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
9282 __Pyx_GOTREF(__pyx_t_5);
9283 __pyx_t_1 = PyTuple_New(3);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
9284 __Pyx_GOTREF(__pyx_t_1);
9285 __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
9286 __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
9287 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
9288 __Pyx_INCREF(__pyx_int_184977713);
9289 __Pyx_GIVEREF(__pyx_int_184977713);
9290 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
9291 __Pyx_INCREF(__pyx_v_state);
9292 __Pyx_GIVEREF(__pyx_v_state);
9293 PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
9294 __pyx_t_4 = PyTuple_New(2);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
9295 __Pyx_GOTREF(__pyx_t_4);
9296 __Pyx_GIVEREF(__pyx_t_5);
9297 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
9298 __Pyx_GIVEREF(__pyx_t_1);
9299 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
9302 __pyx_r = __pyx_t_4;
9315 __Pyx_XDECREF(__pyx_t_1);
9316 __Pyx_XDECREF(__pyx_t_4);
9317 __Pyx_XDECREF(__pyx_t_5);
9318 __Pyx_AddTraceback(
"View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9321 __Pyx_XDECREF(__pyx_v_state);
9322 __Pyx_XDECREF(__pyx_v__dict);
9323 __Pyx_XGIVEREF(__pyx_r);
9324 __Pyx_RefNannyFinishContext();
9336 static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state);
9337 static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
9338 PyObject *__pyx_r = 0;
9339 __Pyx_RefNannyDeclarations
9340 __Pyx_RefNannySetupContext(
"__setstate_cython__ (wrapper)", 0);
9341 __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((
struct __pyx_MemviewEnum_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
9344 __Pyx_RefNannyFinishContext();
9348 static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(
struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
9349 PyObject *__pyx_r = NULL;
9350 __Pyx_RefNannyDeclarations
9351 PyObject *__pyx_t_1 = NULL;
9352 int __pyx_lineno = 0;
9353 const char *__pyx_filename = NULL;
9354 int __pyx_clineno = 0;
9355 __Pyx_RefNannySetupContext(
"__setstate_cython__", 0);
9362 if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError,
"Expected %.16s, got %.200s",
"tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
9363 __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state));
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
9364 __Pyx_GOTREF(__pyx_t_1);
9365 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9375 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9378 __Pyx_XDECREF(__pyx_t_1);
9379 __Pyx_AddTraceback(
"View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9382 __Pyx_XGIVEREF(__pyx_r);
9383 __Pyx_RefNannyFinishContext();
9395 static void *__pyx_align_pointer(
void *__pyx_v_memory,
size_t __pyx_v_alignment) {
9396 Py_intptr_t __pyx_v_aligned_p;
9397 size_t __pyx_v_offset;
9408 __pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory);
9417 __pyx_v_offset = (__pyx_v_aligned_p % __pyx_v_alignment);
9426 __pyx_t_1 = ((__pyx_v_offset > 0) != 0);
9436 __pyx_v_aligned_p = (__pyx_v_aligned_p + (__pyx_v_alignment - __pyx_v_offset));
9454 __pyx_r = ((
void *)__pyx_v_aligned_p);
9479 static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
9480 static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
9481 PyObject *__pyx_v_obj = 0;
9483 int __pyx_v_dtype_is_object;
9484 int __pyx_lineno = 0;
9485 const char *__pyx_filename = NULL;
9486 int __pyx_clineno = 0;
9488 __Pyx_RefNannyDeclarations
9489 __Pyx_RefNannySetupContext(
"__cinit__ (wrapper)", 0);
9491 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0};
9492 PyObject* values[3] = {0,0,0};
9493 if (unlikely(__pyx_kwds)) {
9495 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
9497 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9499 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9501 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9504 default:
goto __pyx_L5_argtuple_error;
9506 kw_args = PyDict_Size(__pyx_kwds);
9509 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--;
9510 else goto __pyx_L5_argtuple_error;
9513 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--;
9515 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 0, 2, 3, 1); __PYX_ERR(1, 345, __pyx_L3_error)
9520 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtype_is_object);
9521 if (value) { values[2] = value; kw_args--; }
9524 if (unlikely(kw_args > 0)) {
9525 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__cinit__") < 0)) __PYX_ERR(1, 345, __pyx_L3_error)
9528 switch (PyTuple_GET_SIZE(__pyx_args)) {
9529 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9531 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9532 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9534 default:
goto __pyx_L5_argtuple_error;
9537 __pyx_v_obj = values[0];
9538 __pyx_v_flags = __Pyx_PyInt_As_int(values[1]);
if (unlikely((__pyx_v_flags == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 345, __pyx_L3_error)
9540 __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]);
if (unlikely((__pyx_v_dtype_is_object == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 345, __pyx_L3_error)
9542 __pyx_v_dtype_is_object = ((int)0);
9545 goto __pyx_L4_argument_unpacking_done;
9546 __pyx_L5_argtuple_error:;
9547 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 345, __pyx_L3_error)
9549 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9550 __Pyx_RefNannyFinishContext();
9552 __pyx_L4_argument_unpacking_done:;
9553 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((
struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object);
9556 __Pyx_RefNannyFinishContext();
9560 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj,
int __pyx_v_flags,
int __pyx_v_dtype_is_object) {
9562 __Pyx_RefNannyDeclarations
9567 int __pyx_lineno = 0;
9568 const char *__pyx_filename = NULL;
9569 int __pyx_clineno = 0;
9570 __Pyx_RefNannySetupContext(
"__cinit__", 0);
9579 __Pyx_INCREF(__pyx_v_obj);
9580 __Pyx_GIVEREF(__pyx_v_obj);
9581 __Pyx_GOTREF(__pyx_v_self->obj);
9582 __Pyx_DECREF(__pyx_v_self->obj);
9583 __pyx_v_self->obj = __pyx_v_obj;
9592 __pyx_v_self->flags = __pyx_v_flags;
9601 __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type));
9602 __pyx_t_3 = (__pyx_t_2 != 0);
9605 __pyx_t_1 = __pyx_t_3;
9606 goto __pyx_L4_bool_binop_done;
9608 __pyx_t_3 = (__pyx_v_obj != Py_None);
9609 __pyx_t_2 = (__pyx_t_3 != 0);
9610 __pyx_t_1 = __pyx_t_2;
9611 __pyx_L4_bool_binop_done:;
9621 __pyx_t_4 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags);
if (unlikely(__pyx_t_4 == ((
int)-1))) __PYX_ERR(1, 349, __pyx_L1_error)
9630 __pyx_t_1 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0);
9640 ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None;
9676 __pyx_t_1 = ((__pyx_memoryview_thread_locks_used < 8) != 0);
9686 __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
9695 __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1);
9713 __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
9723 __pyx_v_self->lock = PyThread_allocate_lock();
9732 __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
9733 if (unlikely(__pyx_t_1)) {
9742 PyErr_NoMemory(); __PYX_ERR(1, 361, __pyx_L1_error)
9769 __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
9779 __pyx_t_2 = (((__pyx_v_self->view.format[0]) ==
'O') != 0);
9782 __pyx_t_1 = __pyx_t_2;
9783 goto __pyx_L11_bool_binop_done;
9785 __pyx_t_2 = (((__pyx_v_self->view.format[1]) ==
'\x00') != 0);
9786 __pyx_t_1 = __pyx_t_2;
9787 __pyx_L11_bool_binop_done:;
9788 __pyx_v_self->dtype_is_object = __pyx_t_1;
9808 __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object;
9819 __pyx_v_self->acquisition_count_aligned_p = ((__pyx_atomic_int *)__pyx_align_pointer(((
void *)(&(__pyx_v_self->acquisition_count[0]))), (
sizeof(__pyx_atomic_int))));
9828 __pyx_v_self->typeinfo = NULL;
9842 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9845 __Pyx_RefNannyFinishContext();
9858 static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self);
9859 static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
9860 __Pyx_RefNannyDeclarations
9861 __Pyx_RefNannySetupContext(
"__dealloc__ (wrapper)", 0);
9862 __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
9865 __Pyx_RefNannyFinishContext();
9868 static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(
struct __pyx_memoryview_obj *__pyx_v_self) {
9870 __Pyx_RefNannyDeclarations
9876 PyThread_type_lock __pyx_t_6;
9877 PyThread_type_lock __pyx_t_7;
9878 __Pyx_RefNannySetupContext(
"__dealloc__", 0);
9887 __pyx_t_1 = (__pyx_v_self->obj != Py_None);
9888 __pyx_t_2 = (__pyx_t_1 != 0);
9898 __Pyx_ReleaseBuffer((&__pyx_v_self->view));
9917 __pyx_t_2 = ((((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None) != 0);
9927 ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL;
9955 __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0);
9965 __pyx_t_3 = __pyx_memoryview_thread_locks_used;
9966 __pyx_t_4 = __pyx_t_3;
9967 for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
9968 __pyx_v_i = __pyx_t_5;
9977 __pyx_t_2 = (((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock) != 0);
9987 __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1);
9996 __pyx_t_2 = ((__pyx_v_i != __pyx_memoryview_thread_locks_used) != 0);
10006 __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
10007 __pyx_t_7 = (__pyx_memoryview_thread_locks[__pyx_v_i]);
10016 (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_6;
10017 (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_7;
10035 goto __pyx_L6_break;
10055 PyThread_free_lock(__pyx_v_self->lock);
10077 __Pyx_RefNannyFinishContext();
10088 static char *__pyx_memoryview_get_item_pointer(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
10089 Py_ssize_t __pyx_v_dim;
10090 char *__pyx_v_itemp;
10091 PyObject *__pyx_v_idx = NULL;
10093 __Pyx_RefNannyDeclarations
10094 Py_ssize_t __pyx_t_1;
10095 PyObject *__pyx_t_2 = NULL;
10096 Py_ssize_t __pyx_t_3;
10097 PyObject *(*__pyx_t_4)(PyObject *);
10098 PyObject *__pyx_t_5 = NULL;
10099 Py_ssize_t __pyx_t_6;
10101 int __pyx_lineno = 0;
10102 const char *__pyx_filename = NULL;
10103 int __pyx_clineno = 0;
10104 __Pyx_RefNannySetupContext(
"get_item_pointer", 0);
10113 __pyx_v_itemp = ((
char *)__pyx_v_self->view.buf);
10123 if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) {
10124 __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
10127 __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 397, __pyx_L1_error)
10128 __Pyx_GOTREF(__pyx_t_2);
10129 __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext;
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 397, __pyx_L1_error)
10132 if (likely(!__pyx_t_4)) {
10133 if (likely(PyList_CheckExact(__pyx_t_2))) {
10134 if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2))
break;
10135 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10136 __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++;
if (unlikely(0 < 0)) __PYX_ERR(1, 397, __pyx_L1_error)
10138 __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++;
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 397, __pyx_L1_error)
10139 __Pyx_GOTREF(__pyx_t_5);
10142 if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2))
break;
10143 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10144 __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++;
if (unlikely(0 < 0)) __PYX_ERR(1, 397, __pyx_L1_error)
10146 __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++;
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 397, __pyx_L1_error)
10147 __Pyx_GOTREF(__pyx_t_5);
10151 __pyx_t_5 = __pyx_t_4(__pyx_t_2);
10152 if (unlikely(!__pyx_t_5)) {
10153 PyObject* exc_type = PyErr_Occurred();
10155 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
10156 else __PYX_ERR(1, 397, __pyx_L1_error)
10160 __Pyx_GOTREF(__pyx_t_5);
10162 __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5);
10164 __pyx_v_dim = __pyx_t_1;
10165 __pyx_t_1 = (__pyx_t_1 + 1);
10174 __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx);
if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 398, __pyx_L1_error)
10175 __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim);
if (unlikely(__pyx_t_7 == ((
char *)NULL))) __PYX_ERR(1, 398, __pyx_L1_error)
10176 __pyx_v_itemp = __pyx_t_7;
10186 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10195 __pyx_r = __pyx_v_itemp;
10208 __Pyx_XDECREF(__pyx_t_2);
10209 __Pyx_XDECREF(__pyx_t_5);
10210 __Pyx_AddTraceback(
"View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename);
10213 __Pyx_XDECREF(__pyx_v_idx);
10214 __Pyx_RefNannyFinishContext();
10227 static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index);
10228 static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
10229 PyObject *__pyx_r = 0;
10230 __Pyx_RefNannyDeclarations
10231 __Pyx_RefNannySetupContext(
"__getitem__ (wrapper)", 0);
10232 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((
struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index));
10235 __Pyx_RefNannyFinishContext();
10239 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
10240 PyObject *__pyx_v_have_slices = NULL;
10241 PyObject *__pyx_v_indices = NULL;
10242 char *__pyx_v_itemp;
10243 PyObject *__pyx_r = NULL;
10244 __Pyx_RefNannyDeclarations
10247 PyObject *__pyx_t_3 = NULL;
10248 PyObject *__pyx_t_4 = NULL;
10249 PyObject *__pyx_t_5 = NULL;
10251 int __pyx_lineno = 0;
10252 const char *__pyx_filename = NULL;
10253 int __pyx_clineno = 0;
10254 __Pyx_RefNannySetupContext(
"__getitem__", 0);
10263 __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
10264 __pyx_t_2 = (__pyx_t_1 != 0);
10274 __Pyx_XDECREF(__pyx_r);
10275 __Pyx_INCREF(((PyObject *)__pyx_v_self));
10276 __pyx_r = ((PyObject *)__pyx_v_self);
10295 __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 407, __pyx_L1_error)
10296 __Pyx_GOTREF(__pyx_t_3);
10297 if (likely(__pyx_t_3 != Py_None)) {
10298 PyObject* sequence = __pyx_t_3;
10299 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
10300 if (unlikely(size != 2)) {
10301 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
10302 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
10303 __PYX_ERR(1, 407, __pyx_L1_error)
10305 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10306 __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
10307 __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
10308 __Pyx_INCREF(__pyx_t_4);
10309 __Pyx_INCREF(__pyx_t_5);
10311 __pyx_t_4 = PySequence_ITEM(sequence, 0);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 407, __pyx_L1_error)
10312 __Pyx_GOTREF(__pyx_t_4);
10313 __pyx_t_5 = PySequence_ITEM(sequence, 1);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 407, __pyx_L1_error)
10314 __Pyx_GOTREF(__pyx_t_5);
10316 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10318 __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 407, __pyx_L1_error)
10320 __pyx_v_have_slices = __pyx_t_4;
10322 __pyx_v_indices = __pyx_t_5;
10332 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices);
if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 410, __pyx_L1_error)
10342 __Pyx_XDECREF(__pyx_r);
10343 __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices));
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 411, __pyx_L1_error)
10344 __Pyx_GOTREF(__pyx_t_3);
10345 __pyx_r = __pyx_t_3;
10366 __pyx_t_6 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices);
if (unlikely(__pyx_t_6 == ((
char *)NULL))) __PYX_ERR(1, 413, __pyx_L1_error)
10367 __pyx_v_itemp = __pyx_t_6;
10376 __Pyx_XDECREF(__pyx_r);
10377 __pyx_t_3 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 414, __pyx_L1_error)
10378 __Pyx_GOTREF(__pyx_t_3);
10379 __pyx_r = __pyx_t_3;
10394 __Pyx_XDECREF(__pyx_t_3);
10395 __Pyx_XDECREF(__pyx_t_4);
10396 __Pyx_XDECREF(__pyx_t_5);
10397 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10400 __Pyx_XDECREF(__pyx_v_have_slices);
10401 __Pyx_XDECREF(__pyx_v_indices);
10402 __Pyx_XGIVEREF(__pyx_r);
10403 __Pyx_RefNannyFinishContext();
10416 static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value);
10417 static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
10419 __Pyx_RefNannyDeclarations
10420 __Pyx_RefNannySetupContext(
"__setitem__ (wrapper)", 0);
10421 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((
struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value));
10424 __Pyx_RefNannyFinishContext();
10428 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
10429 PyObject *__pyx_v_have_slices = NULL;
10430 PyObject *__pyx_v_obj = NULL;
10432 __Pyx_RefNannyDeclarations
10434 PyObject *__pyx_t_2 = NULL;
10435 PyObject *__pyx_t_3 = NULL;
10436 PyObject *__pyx_t_4 = NULL;
10437 int __pyx_lineno = 0;
10438 const char *__pyx_filename = NULL;
10439 int __pyx_clineno = 0;
10440 __Pyx_RefNannySetupContext(
"__setitem__", 0);
10441 __Pyx_INCREF(__pyx_v_index);
10450 __pyx_t_1 = (__pyx_v_self->view.readonly != 0);
10451 if (unlikely(__pyx_t_1)) {
10460 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__15, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 418, __pyx_L1_error)
10461 __Pyx_GOTREF(__pyx_t_2);
10462 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
10463 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10464 __PYX_ERR(1, 418, __pyx_L1_error)
10482 __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 420, __pyx_L1_error)
10483 __Pyx_GOTREF(__pyx_t_2);
10484 if (likely(__pyx_t_2 != Py_None)) {
10485 PyObject* sequence = __pyx_t_2;
10486 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
10487 if (unlikely(size != 2)) {
10488 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
10489 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
10490 __PYX_ERR(1, 420, __pyx_L1_error)
10492 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10493 __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
10494 __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
10495 __Pyx_INCREF(__pyx_t_3);
10496 __Pyx_INCREF(__pyx_t_4);
10498 __pyx_t_3 = PySequence_ITEM(sequence, 0);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 420, __pyx_L1_error)
10499 __Pyx_GOTREF(__pyx_t_3);
10500 __pyx_t_4 = PySequence_ITEM(sequence, 1);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 420, __pyx_L1_error)
10501 __Pyx_GOTREF(__pyx_t_4);
10503 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10505 __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 420, __pyx_L1_error)
10507 __pyx_v_have_slices = __pyx_t_3;
10509 __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_4);
10519 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 422, __pyx_L1_error)
10529 __pyx_t_2 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 423, __pyx_L1_error)
10530 __Pyx_GOTREF(__pyx_t_2);
10531 __pyx_v_obj = __pyx_t_2;
10541 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_obj);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 424, __pyx_L1_error)
10551 __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 425, __pyx_L1_error)
10552 __Pyx_GOTREF(__pyx_t_2);
10553 __pyx_t_4 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_2, __pyx_v_obj);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 425, __pyx_L1_error)
10554 __Pyx_GOTREF(__pyx_t_4);
10555 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10556 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10576 __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 427, __pyx_L1_error)
10577 __Pyx_GOTREF(__pyx_t_4);
10578 if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_memoryview_type))))) __PYX_ERR(1, 427, __pyx_L1_error)
10579 __pyx_t_2 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((
struct __pyx_memoryview_obj *)__pyx_t_4), __pyx_v_value);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 427, __pyx_L1_error)
10580 __Pyx_GOTREF(__pyx_t_2);
10581 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10582 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10604 __pyx_t_2 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 429, __pyx_L1_error)
10605 __Pyx_GOTREF(__pyx_t_2);
10606 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10622 __Pyx_XDECREF(__pyx_t_2);
10623 __Pyx_XDECREF(__pyx_t_3);
10624 __Pyx_XDECREF(__pyx_t_4);
10625 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10628 __Pyx_XDECREF(__pyx_v_have_slices);
10629 __Pyx_XDECREF(__pyx_v_obj);
10630 __Pyx_XDECREF(__pyx_v_index);
10631 __Pyx_RefNannyFinishContext();
10643 static PyObject *__pyx_memoryview_is_slice(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) {
10644 PyObject *__pyx_r = NULL;
10645 __Pyx_RefNannyDeclarations
10648 PyObject *__pyx_t_3 = NULL;
10649 PyObject *__pyx_t_4 = NULL;
10650 PyObject *__pyx_t_5 = NULL;
10651 PyObject *__pyx_t_6 = NULL;
10652 PyObject *__pyx_t_7 = NULL;
10653 PyObject *__pyx_t_8 = NULL;
10655 int __pyx_lineno = 0;
10656 const char *__pyx_filename = NULL;
10657 int __pyx_clineno = 0;
10658 __Pyx_RefNannySetupContext(
"is_slice", 0);
10659 __Pyx_INCREF(__pyx_v_obj);
10668 __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type);
10669 __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
10680 __Pyx_PyThreadState_declare
10681 __Pyx_PyThreadState_assign
10682 __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
10683 __Pyx_XGOTREF(__pyx_t_3);
10684 __Pyx_XGOTREF(__pyx_t_4);
10685 __Pyx_XGOTREF(__pyx_t_5);
10695 __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS));
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 434, __pyx_L4_error)
10696 __Pyx_GOTREF(__pyx_t_6);
10705 __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object);
if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 435, __pyx_L4_error)
10706 __Pyx_GOTREF(__pyx_t_7);
10715 __pyx_t_8 = PyTuple_New(3);
if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 434, __pyx_L4_error)
10716 __Pyx_GOTREF(__pyx_t_8);
10717 __Pyx_INCREF(__pyx_v_obj);
10718 __Pyx_GIVEREF(__pyx_v_obj);
10719 PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj);
10720 __Pyx_GIVEREF(__pyx_t_6);
10721 PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
10722 __Pyx_GIVEREF(__pyx_t_7);
10723 PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
10726 __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL);
if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 434, __pyx_L4_error)
10727 __Pyx_GOTREF(__pyx_t_7);
10728 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
10729 __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7);
10740 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
10741 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
10742 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
10743 goto __pyx_L9_try_end;
10745 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
10746 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
10747 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
10756 __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
10758 __Pyx_AddTraceback(
"View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
10759 if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(1, 436, __pyx_L6_except_error)
10760 __Pyx_GOTREF(__pyx_t_7);
10761 __Pyx_GOTREF(__pyx_t_8);
10762 __Pyx_GOTREF(__pyx_t_6);
10771 __Pyx_XDECREF(__pyx_r);
10772 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10773 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10774 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10775 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
10776 goto __pyx_L7_except_return;
10778 goto __pyx_L6_except_error;
10779 __pyx_L6_except_error:;
10788 __Pyx_XGIVEREF(__pyx_t_3);
10789 __Pyx_XGIVEREF(__pyx_t_4);
10790 __Pyx_XGIVEREF(__pyx_t_5);
10791 __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
10792 goto __pyx_L1_error;
10793 __pyx_L7_except_return:;
10794 __Pyx_XGIVEREF(__pyx_t_3);
10795 __Pyx_XGIVEREF(__pyx_t_4);
10796 __Pyx_XGIVEREF(__pyx_t_5);
10797 __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
10818 __Pyx_XDECREF(__pyx_r);
10819 __Pyx_INCREF(__pyx_v_obj);
10820 __pyx_r = __pyx_v_obj;
10833 __Pyx_XDECREF(__pyx_t_6);
10834 __Pyx_XDECREF(__pyx_t_7);
10835 __Pyx_XDECREF(__pyx_t_8);
10836 __Pyx_AddTraceback(
"View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
10839 __Pyx_XDECREF(__pyx_v_obj);
10840 __Pyx_XGIVEREF(__pyx_r);
10841 __Pyx_RefNannyFinishContext();
10853 static PyObject *__pyx_memoryview_setitem_slice_assignment(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) {
10854 __Pyx_memviewslice __pyx_v_dst_slice;
10855 __Pyx_memviewslice __pyx_v_src_slice;
10856 PyObject *__pyx_r = NULL;
10857 __Pyx_RefNannyDeclarations
10858 __Pyx_memviewslice *__pyx_t_1;
10859 __Pyx_memviewslice *__pyx_t_2;
10860 PyObject *__pyx_t_3 = NULL;
10864 int __pyx_lineno = 0;
10865 const char *__pyx_filename = NULL;
10866 int __pyx_clineno = 0;
10867 __Pyx_RefNannySetupContext(
"setitem_slice_assignment", 0);
10876 if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(1, 445, __pyx_L1_error)
10877 __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((
struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice));
if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 445, __pyx_L1_error)
10886 if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(1, 446, __pyx_L1_error)
10887 __pyx_t_2 = __pyx_memoryview_get_slice_from_memoryview(((
struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice));
if (unlikely(__pyx_t_2 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 446, __pyx_L1_error)
10896 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 447, __pyx_L1_error)
10897 __Pyx_GOTREF(__pyx_t_3);
10898 __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3);
if (unlikely((__pyx_t_4 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 447, __pyx_L1_error)
10899 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10900 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 447, __pyx_L1_error)
10901 __Pyx_GOTREF(__pyx_t_3);
10902 __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3);
if (unlikely((__pyx_t_5 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 447, __pyx_L1_error)
10903 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10912 __pyx_t_6 = __pyx_memoryview_copy_contents((__pyx_t_1[0]), (__pyx_t_2[0]), __pyx_t_4, __pyx_t_5, __pyx_v_self->dtype_is_object);
if (unlikely(__pyx_t_6 == ((
int)-1))) __PYX_ERR(1, 445, __pyx_L1_error)
10923 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10926 __Pyx_XDECREF(__pyx_t_3);
10927 __Pyx_AddTraceback(
"View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
10930 __Pyx_XGIVEREF(__pyx_r);
10931 __Pyx_RefNannyFinishContext();
10943 static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(
struct __pyx_memoryview_obj *__pyx_v_self,
struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) {
10944 int __pyx_v_array[0x80];
10946 void *__pyx_v_item;
10947 __Pyx_memviewslice *__pyx_v_dst_slice;
10948 __Pyx_memviewslice __pyx_v_tmp_slice;
10949 PyObject *__pyx_r = NULL;
10950 __Pyx_RefNannyDeclarations
10951 __Pyx_memviewslice *__pyx_t_1;
10953 PyObject *__pyx_t_3 = NULL;
10956 char const *__pyx_t_6;
10957 PyObject *__pyx_t_7 = NULL;
10958 PyObject *__pyx_t_8 = NULL;
10959 PyObject *__pyx_t_9 = NULL;
10960 PyObject *__pyx_t_10 = NULL;
10961 PyObject *__pyx_t_11 = NULL;
10962 PyObject *__pyx_t_12 = NULL;
10963 int __pyx_lineno = 0;
10964 const char *__pyx_filename = NULL;
10965 int __pyx_clineno = 0;
10966 __Pyx_RefNannySetupContext(
"setitem_slice_assign_scalar", 0);
10975 __pyx_v_tmp = NULL;
10984 __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice));
if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 456, __pyx_L1_error)
10985 __pyx_v_dst_slice = __pyx_t_1;
10994 __pyx_t_2 = ((((size_t)__pyx_v_self->view.itemsize) > (
sizeof(__pyx_v_array))) != 0);
11004 __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize);
11013 __pyx_t_2 = ((__pyx_v_tmp == NULL) != 0);
11014 if (unlikely(__pyx_t_2)) {
11023 PyErr_NoMemory(); __PYX_ERR(1, 461, __pyx_L1_error)
11041 __pyx_v_item = __pyx_v_tmp;
11061 __pyx_v_item = ((
void *)__pyx_v_array);
11081 __pyx_t_2 = (__pyx_v_self->dtype_is_object != 0);
11091 (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value);
11111 __pyx_t_3 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((
char *)__pyx_v_item), __pyx_v_value);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 470, __pyx_L6_error)
11112 __Pyx_GOTREF(__pyx_t_3);
11113 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11124 __pyx_t_2 = ((__pyx_v_self->view.suboffsets != NULL) != 0);
11134 __pyx_t_3 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 475, __pyx_L6_error)
11135 __Pyx_GOTREF(__pyx_t_3);
11136 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11154 __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object);
11166 PyMem_Free(__pyx_v_tmp);
11171 __Pyx_PyThreadState_declare
11172 __Pyx_PyThreadState_assign
11173 __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
11174 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
11175 if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
11176 if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
11177 __Pyx_XGOTREF(__pyx_t_7);
11178 __Pyx_XGOTREF(__pyx_t_8);
11179 __Pyx_XGOTREF(__pyx_t_9);
11180 __Pyx_XGOTREF(__pyx_t_10);
11181 __Pyx_XGOTREF(__pyx_t_11);
11182 __Pyx_XGOTREF(__pyx_t_12);
11183 __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
11185 PyMem_Free(__pyx_v_tmp);
11187 if (PY_MAJOR_VERSION >= 3) {
11188 __Pyx_XGIVEREF(__pyx_t_10);
11189 __Pyx_XGIVEREF(__pyx_t_11);
11190 __Pyx_XGIVEREF(__pyx_t_12);
11191 __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
11193 __Pyx_XGIVEREF(__pyx_t_7);
11194 __Pyx_XGIVEREF(__pyx_t_8);
11195 __Pyx_XGIVEREF(__pyx_t_9);
11196 __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
11197 __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
11198 __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
11199 goto __pyx_L1_error;
11213 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
11216 __Pyx_XDECREF(__pyx_t_3);
11217 __Pyx_AddTraceback(
"View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
11220 __Pyx_XGIVEREF(__pyx_r);
11221 __Pyx_RefNannyFinishContext();
11233 static PyObject *__pyx_memoryview_setitem_indexed(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
11234 char *__pyx_v_itemp;
11235 PyObject *__pyx_r = NULL;
11236 __Pyx_RefNannyDeclarations
11238 PyObject *__pyx_t_2 = NULL;
11239 int __pyx_lineno = 0;
11240 const char *__pyx_filename = NULL;
11241 int __pyx_clineno = 0;
11242 __Pyx_RefNannySetupContext(
"setitem_indexed", 0);
11251 __pyx_t_1 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index);
if (unlikely(__pyx_t_1 == ((
char *)NULL))) __PYX_ERR(1, 482, __pyx_L1_error)
11252 __pyx_v_itemp = __pyx_t_1;
11261 __pyx_t_2 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 483, __pyx_L1_error)
11262 __Pyx_GOTREF(__pyx_t_2);
11263 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11274 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
11277 __Pyx_XDECREF(__pyx_t_2);
11278 __Pyx_AddTraceback(
"View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename);
11281 __Pyx_XGIVEREF(__pyx_r);
11282 __Pyx_RefNannyFinishContext();
11294 static PyObject *__pyx_memoryview_convert_item_to_object(
struct __pyx_memoryview_obj *__pyx_v_self,
char *__pyx_v_itemp) {
11295 PyObject *__pyx_v_struct = NULL;
11296 PyObject *__pyx_v_bytesitem = 0;
11297 PyObject *__pyx_v_result = NULL;
11298 PyObject *__pyx_r = NULL;
11299 __Pyx_RefNannyDeclarations
11300 PyObject *__pyx_t_1 = NULL;
11301 PyObject *__pyx_t_2 = NULL;
11302 PyObject *__pyx_t_3 = NULL;
11303 PyObject *__pyx_t_4 = NULL;
11304 PyObject *__pyx_t_5 = NULL;
11305 PyObject *__pyx_t_6 = NULL;
11306 PyObject *__pyx_t_7 = NULL;
11308 PyObject *__pyx_t_9 = NULL;
11311 int __pyx_lineno = 0;
11312 const char *__pyx_filename = NULL;
11313 int __pyx_clineno = 0;
11314 __Pyx_RefNannySetupContext(
"convert_item_to_object", 0);
11323 __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 488, __pyx_L1_error)
11324 __Pyx_GOTREF(__pyx_t_1);
11325 __pyx_v_struct = __pyx_t_1;
11335 __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 491, __pyx_L1_error)
11336 __Pyx_GOTREF(__pyx_t_1);
11337 __pyx_v_bytesitem = ((PyObject*)__pyx_t_1);
11348 __Pyx_PyThreadState_declare
11349 __Pyx_PyThreadState_assign
11350 __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
11351 __Pyx_XGOTREF(__pyx_t_2);
11352 __Pyx_XGOTREF(__pyx_t_3);
11353 __Pyx_XGOTREF(__pyx_t_4);
11363 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 493, __pyx_L3_error)
11364 __Pyx_GOTREF(__pyx_t_5);
11365 __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 493, __pyx_L3_error)
11366 __Pyx_GOTREF(__pyx_t_6);
11369 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
11370 __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
11371 if (likely(__pyx_t_7)) {
11372 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_5);
11373 __Pyx_INCREF(__pyx_t_7);
11374 __Pyx_INCREF(
function);
11375 __Pyx_DECREF_SET(__pyx_t_5,
function);
11379 #if CYTHON_FAST_PYCALL
11380 if (PyFunction_Check(__pyx_t_5)) {
11381 PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
11382 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 493, __pyx_L3_error)
11383 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
11384 __Pyx_GOTREF(__pyx_t_1);
11385 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11388 #if CYTHON_FAST_PYCCALL
11389 if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
11390 PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
11391 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 493, __pyx_L3_error)
11392 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
11393 __Pyx_GOTREF(__pyx_t_1);
11394 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11398 __pyx_t_9 = PyTuple_New(2+__pyx_t_8);
if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 493, __pyx_L3_error)
11399 __Pyx_GOTREF(__pyx_t_9);
11401 __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
11403 __Pyx_GIVEREF(__pyx_t_6);
11404 PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6);
11405 __Pyx_INCREF(__pyx_v_bytesitem);
11406 __Pyx_GIVEREF(__pyx_v_bytesitem);
11407 PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_bytesitem);
11409 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 493, __pyx_L3_error)
11410 __Pyx_GOTREF(__pyx_t_1);
11411 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
11413 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11414 __pyx_v_result = __pyx_t_1;
11434 __pyx_t_10 = strlen(__pyx_v_self->view.format);
11435 __pyx_t_11 = ((__pyx_t_10 == 1) != 0);
11445 __Pyx_XDECREF(__pyx_r);
11446 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0,
long, 1, __Pyx_PyInt_From_long, 0, 0, 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 498, __pyx_L5_except_error)
11447 __Pyx_GOTREF(__pyx_t_1);
11448 __pyx_r = __pyx_t_1;
11450 goto __pyx_L6_except_return;
11468 __Pyx_XDECREF(__pyx_r);
11469 __Pyx_INCREF(__pyx_v_result);
11470 __pyx_r = __pyx_v_result;
11471 goto __pyx_L6_except_return;
11474 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
11475 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
11476 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
11477 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
11478 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
11487 __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9);
11488 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 494, __pyx_L5_except_error)
11489 __Pyx_GOTREF(__pyx_t_6);
11490 __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6);
11491 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11492 __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_9);
11493 __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_9 = 0;
11495 __Pyx_AddTraceback(
"View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
11496 if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(1, 494, __pyx_L5_except_error)
11497 __Pyx_GOTREF(__pyx_t_9);
11498 __Pyx_GOTREF(__pyx_t_5);
11499 __Pyx_GOTREF(__pyx_t_1);
11508 __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__16, NULL);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 495, __pyx_L5_except_error)
11509 __Pyx_GOTREF(__pyx_t_6);
11510 __Pyx_Raise(__pyx_t_6, 0, 0, 0);
11511 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11512 __PYX_ERR(1, 495, __pyx_L5_except_error)
11514 goto __pyx_L5_except_error;
11515 __pyx_L5_except_error:;
11524 __Pyx_XGIVEREF(__pyx_t_2);
11525 __Pyx_XGIVEREF(__pyx_t_3);
11526 __Pyx_XGIVEREF(__pyx_t_4);
11527 __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
11528 goto __pyx_L1_error;
11529 __pyx_L6_except_return:;
11530 __Pyx_XGIVEREF(__pyx_t_2);
11531 __Pyx_XGIVEREF(__pyx_t_3);
11532 __Pyx_XGIVEREF(__pyx_t_4);
11533 __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
11547 __Pyx_XDECREF(__pyx_t_1);
11548 __Pyx_XDECREF(__pyx_t_5);
11549 __Pyx_XDECREF(__pyx_t_6);
11550 __Pyx_XDECREF(__pyx_t_7);
11551 __Pyx_XDECREF(__pyx_t_9);
11552 __Pyx_AddTraceback(
"View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
11555 __Pyx_XDECREF(__pyx_v_struct);
11556 __Pyx_XDECREF(__pyx_v_bytesitem);
11557 __Pyx_XDECREF(__pyx_v_result);
11558 __Pyx_XGIVEREF(__pyx_r);
11559 __Pyx_RefNannyFinishContext();
11571 static PyObject *__pyx_memoryview_assign_item_from_object(
struct __pyx_memoryview_obj *__pyx_v_self,
char *__pyx_v_itemp, PyObject *__pyx_v_value) {
11572 PyObject *__pyx_v_struct = NULL;
11574 PyObject *__pyx_v_bytesvalue = 0;
11575 Py_ssize_t __pyx_v_i;
11576 PyObject *__pyx_r = NULL;
11577 __Pyx_RefNannyDeclarations
11578 PyObject *__pyx_t_1 = NULL;
11581 PyObject *__pyx_t_4 = NULL;
11582 PyObject *__pyx_t_5 = NULL;
11583 PyObject *__pyx_t_6 = NULL;
11585 PyObject *__pyx_t_8 = NULL;
11586 Py_ssize_t __pyx_t_9;
11587 PyObject *__pyx_t_10 = NULL;
11592 int __pyx_lineno = 0;
11593 const char *__pyx_filename = NULL;
11594 int __pyx_clineno = 0;
11595 __Pyx_RefNannySetupContext(
"assign_item_from_object", 0);
11604 __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 504, __pyx_L1_error)
11605 __Pyx_GOTREF(__pyx_t_1);
11606 __pyx_v_struct = __pyx_t_1;
11616 __pyx_t_2 = PyTuple_Check(__pyx_v_value);
11617 __pyx_t_3 = (__pyx_t_2 != 0);
11627 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 510, __pyx_L1_error)
11628 __Pyx_GOTREF(__pyx_t_1);
11629 __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 510, __pyx_L1_error)
11630 __Pyx_GOTREF(__pyx_t_4);
11631 __pyx_t_5 = PyTuple_New(1);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 510, __pyx_L1_error)
11632 __Pyx_GOTREF(__pyx_t_5);
11633 __Pyx_GIVEREF(__pyx_t_4);
11634 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
11636 __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 510, __pyx_L1_error)
11637 __Pyx_GOTREF(__pyx_t_4);
11638 __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 510, __pyx_L1_error)
11639 __Pyx_GOTREF(__pyx_t_6);
11640 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11641 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11642 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 510, __pyx_L1_error)
11643 __Pyx_GOTREF(__pyx_t_4);
11644 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11645 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11646 if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError,
"Expected %.16s, got %.200s",
"bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(1, 510, __pyx_L1_error)
11647 __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
11668 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 512, __pyx_L1_error)
11669 __Pyx_GOTREF(__pyx_t_6);
11670 __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 512, __pyx_L1_error)
11671 __Pyx_GOTREF(__pyx_t_1);
11674 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
11675 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
11676 if (likely(__pyx_t_5)) {
11677 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_6);
11678 __Pyx_INCREF(__pyx_t_5);
11679 __Pyx_INCREF(
function);
11680 __Pyx_DECREF_SET(__pyx_t_6,
function);
11684 #if CYTHON_FAST_PYCALL
11685 if (PyFunction_Check(__pyx_t_6)) {
11686 PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
11687 __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 512, __pyx_L1_error)
11688 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
11689 __Pyx_GOTREF(__pyx_t_4);
11690 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11693 #if CYTHON_FAST_PYCCALL
11694 if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
11695 PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
11696 __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 512, __pyx_L1_error)
11697 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
11698 __Pyx_GOTREF(__pyx_t_4);
11699 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11703 __pyx_t_8 = PyTuple_New(2+__pyx_t_7);
if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 512, __pyx_L1_error)
11704 __Pyx_GOTREF(__pyx_t_8);
11706 __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
11708 __Pyx_GIVEREF(__pyx_t_1);
11709 PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_1);
11710 __Pyx_INCREF(__pyx_v_value);
11711 __Pyx_GIVEREF(__pyx_v_value);
11712 PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_value);
11714 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 512, __pyx_L1_error)
11715 __Pyx_GOTREF(__pyx_t_4);
11716 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
11718 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11719 if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError,
"Expected %.16s, got %.200s",
"bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(1, 512, __pyx_L1_error)
11720 __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
11733 if (unlikely(__pyx_v_bytesvalue == Py_None)) {
11734 PyErr_SetString(PyExc_TypeError,
"'NoneType' is not iterable");
11735 __PYX_ERR(1, 514, __pyx_L1_error)
11737 __Pyx_INCREF(__pyx_v_bytesvalue);
11738 __pyx_t_10 = __pyx_v_bytesvalue;
11739 __pyx_t_12 = PyBytes_AS_STRING(__pyx_t_10);
11740 __pyx_t_13 = (__pyx_t_12 + PyBytes_GET_SIZE(__pyx_t_10));
11741 for (__pyx_t_14 = __pyx_t_12; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) {
11742 __pyx_t_11 = __pyx_t_14;
11743 __pyx_v_c = (__pyx_t_11[0]);
11752 __pyx_v_i = __pyx_t_9;
11761 __pyx_t_9 = (__pyx_t_9 + 1);
11770 (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
11772 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
11783 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
11786 __Pyx_XDECREF(__pyx_t_1);
11787 __Pyx_XDECREF(__pyx_t_4);
11788 __Pyx_XDECREF(__pyx_t_5);
11789 __Pyx_XDECREF(__pyx_t_6);
11790 __Pyx_XDECREF(__pyx_t_8);
11791 __Pyx_XDECREF(__pyx_t_10);
11792 __Pyx_AddTraceback(
"View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
11795 __Pyx_XDECREF(__pyx_v_struct);
11796 __Pyx_XDECREF(__pyx_v_bytesvalue);
11797 __Pyx_XGIVEREF(__pyx_r);
11798 __Pyx_RefNannyFinishContext();
11811 static CYTHON_UNUSED
int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
11812 static CYTHON_UNUSED
int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags) {
11814 __Pyx_RefNannyDeclarations
11815 __Pyx_RefNannySetupContext(
"__getbuffer__ (wrapper)", 0);
11816 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((
struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((
int)__pyx_v_flags));
11819 __Pyx_RefNannyFinishContext();
11823 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(
struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags) {
11825 __Pyx_RefNannyDeclarations
11828 PyObject *__pyx_t_3 = NULL;
11829 Py_ssize_t *__pyx_t_4;
11833 Py_ssize_t __pyx_t_8;
11834 int __pyx_lineno = 0;
11835 const char *__pyx_filename = NULL;
11836 int __pyx_clineno = 0;
11837 if (__pyx_v_info == NULL) {
11838 PyErr_SetString(PyExc_BufferError,
"PyObject_GetBuffer: view==NULL argument is obsolete");
11841 __Pyx_RefNannySetupContext(
"__getbuffer__", 0);
11842 __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
11843 __Pyx_GIVEREF(__pyx_v_info->obj);
11852 __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0);
11855 __pyx_t_1 = __pyx_t_2;
11856 goto __pyx_L4_bool_binop_done;
11858 __pyx_t_2 = (__pyx_v_self->view.readonly != 0);
11859 __pyx_t_1 = __pyx_t_2;
11860 __pyx_L4_bool_binop_done:;
11861 if (unlikely(__pyx_t_1)) {
11870 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__17, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 520, __pyx_L1_error)
11871 __Pyx_GOTREF(__pyx_t_3);
11872 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
11873 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11874 __PYX_ERR(1, 520, __pyx_L1_error)
11892 __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0);
11902 __pyx_t_4 = __pyx_v_self->view.shape;
11903 __pyx_v_info->shape = __pyx_t_4;
11923 __pyx_v_info->shape = NULL;
11934 __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
11944 __pyx_t_4 = __pyx_v_self->view.strides;
11945 __pyx_v_info->strides = __pyx_t_4;
11965 __pyx_v_info->strides = NULL;
11976 __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0);
11986 __pyx_t_4 = __pyx_v_self->view.suboffsets;
11987 __pyx_v_info->suboffsets = __pyx_t_4;
12007 __pyx_v_info->suboffsets = NULL;
12018 __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
12028 __pyx_t_5 = __pyx_v_self->view.format;
12029 __pyx_v_info->format = __pyx_t_5;
12049 __pyx_v_info->format = NULL;
12060 __pyx_t_6 = __pyx_v_self->view.buf;
12061 __pyx_v_info->buf = __pyx_t_6;
12070 __pyx_t_7 = __pyx_v_self->view.ndim;
12071 __pyx_v_info->ndim = __pyx_t_7;
12080 __pyx_t_8 = __pyx_v_self->view.itemsize;
12081 __pyx_v_info->itemsize = __pyx_t_8;
12090 __pyx_t_8 = __pyx_v_self->view.len;
12091 __pyx_v_info->len = __pyx_t_8;
12100 __pyx_t_1 = __pyx_v_self->view.readonly;
12101 __pyx_v_info->readonly = __pyx_t_1;
12110 __Pyx_INCREF(((PyObject *)__pyx_v_self));
12111 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
12112 __Pyx_GOTREF(__pyx_v_info->obj);
12113 __Pyx_DECREF(__pyx_v_info->obj);
12114 __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
12128 __Pyx_XDECREF(__pyx_t_3);
12129 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12131 if (__pyx_v_info->obj != NULL) {
12132 __Pyx_GOTREF(__pyx_v_info->obj);
12133 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
12137 if (__pyx_v_info->obj == Py_None) {
12138 __Pyx_GOTREF(__pyx_v_info->obj);
12139 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
12142 __Pyx_RefNannyFinishContext();
12155 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self);
12156 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) {
12157 PyObject *__pyx_r = 0;
12158 __Pyx_RefNannyDeclarations
12159 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
12160 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
12163 __Pyx_RefNannyFinishContext();
12167 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
12168 struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
12169 PyObject *__pyx_r = NULL;
12170 __Pyx_RefNannyDeclarations
12171 PyObject *__pyx_t_1 = NULL;
12173 int __pyx_lineno = 0;
12174 const char *__pyx_filename = NULL;
12175 int __pyx_clineno = 0;
12176 __Pyx_RefNannySetupContext(
"__get__", 0);
12185 __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 554, __pyx_L1_error)
12186 __Pyx_GOTREF(__pyx_t_1);
12187 if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(1, 554, __pyx_L1_error)
12188 __pyx_v_result = ((
struct __pyx_memoryviewslice_obj *)__pyx_t_1);
12198 __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice));
if (unlikely(__pyx_t_2 == ((
int)0))) __PYX_ERR(1, 555, __pyx_L1_error)
12207 __Pyx_XDECREF(__pyx_r);
12208 __Pyx_INCREF(((PyObject *)__pyx_v_result));
12209 __pyx_r = ((PyObject *)__pyx_v_result);
12222 __Pyx_XDECREF(__pyx_t_1);
12223 __Pyx_AddTraceback(
"View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12226 __Pyx_XDECREF((PyObject *)__pyx_v_result);
12227 __Pyx_XGIVEREF(__pyx_r);
12228 __Pyx_RefNannyFinishContext();
12241 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self);
12242 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) {
12243 PyObject *__pyx_r = 0;
12244 __Pyx_RefNannyDeclarations
12245 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
12246 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
12249 __Pyx_RefNannyFinishContext();
12253 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
12254 PyObject *__pyx_r = NULL;
12255 __Pyx_RefNannyDeclarations
12256 __Pyx_RefNannySetupContext(
"__get__", 0);
12265 __Pyx_XDECREF(__pyx_r);
12266 __Pyx_INCREF(__pyx_v_self->obj);
12267 __pyx_r = __pyx_v_self->obj;
12280 __Pyx_XGIVEREF(__pyx_r);
12281 __Pyx_RefNannyFinishContext();
12294 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self);
12295 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) {
12296 PyObject *__pyx_r = 0;
12297 __Pyx_RefNannyDeclarations
12298 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
12299 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
12302 __Pyx_RefNannyFinishContext();
12306 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
12307 Py_ssize_t __pyx_v_length;
12308 PyObject *__pyx_r = NULL;
12309 __Pyx_RefNannyDeclarations
12310 PyObject *__pyx_t_1 = NULL;
12311 Py_ssize_t *__pyx_t_2;
12312 Py_ssize_t *__pyx_t_3;
12313 Py_ssize_t *__pyx_t_4;
12314 PyObject *__pyx_t_5 = NULL;
12315 int __pyx_lineno = 0;
12316 const char *__pyx_filename = NULL;
12317 int __pyx_clineno = 0;
12318 __Pyx_RefNannySetupContext(
"__get__", 0);
12327 __Pyx_XDECREF(__pyx_r);
12328 __pyx_t_1 = PyList_New(0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 564, __pyx_L1_error)
12329 __Pyx_GOTREF(__pyx_t_1);
12330 __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
12331 for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
12332 __pyx_t_2 = __pyx_t_4;
12333 __pyx_v_length = (__pyx_t_2[0]);
12334 __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_length);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 564, __pyx_L1_error)
12335 __Pyx_GOTREF(__pyx_t_5);
12336 if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 564, __pyx_L1_error)
12337 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12339 __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1));
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 564, __pyx_L1_error)
12340 __Pyx_GOTREF(__pyx_t_5);
12341 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12342 __pyx_r = __pyx_t_5;
12356 __Pyx_XDECREF(__pyx_t_1);
12357 __Pyx_XDECREF(__pyx_t_5);
12358 __Pyx_AddTraceback(
"View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12361 __Pyx_XGIVEREF(__pyx_r);
12362 __Pyx_RefNannyFinishContext();
12375 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self);
12376 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) {
12377 PyObject *__pyx_r = 0;
12378 __Pyx_RefNannyDeclarations
12379 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
12380 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
12383 __Pyx_RefNannyFinishContext();
12387 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
12388 Py_ssize_t __pyx_v_stride;
12389 PyObject *__pyx_r = NULL;
12390 __Pyx_RefNannyDeclarations
12392 PyObject *__pyx_t_2 = NULL;
12393 Py_ssize_t *__pyx_t_3;
12394 Py_ssize_t *__pyx_t_4;
12395 Py_ssize_t *__pyx_t_5;
12396 PyObject *__pyx_t_6 = NULL;
12397 int __pyx_lineno = 0;
12398 const char *__pyx_filename = NULL;
12399 int __pyx_clineno = 0;
12400 __Pyx_RefNannySetupContext(
"__get__", 0);
12409 __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0);
12410 if (unlikely(__pyx_t_1)) {
12419 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__18, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 570, __pyx_L1_error)
12420 __Pyx_GOTREF(__pyx_t_2);
12421 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
12422 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12423 __PYX_ERR(1, 570, __pyx_L1_error)
12441 __Pyx_XDECREF(__pyx_r);
12442 __pyx_t_2 = PyList_New(0);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 572, __pyx_L1_error)
12443 __Pyx_GOTREF(__pyx_t_2);
12444 __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim);
12445 for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
12446 __pyx_t_3 = __pyx_t_5;
12447 __pyx_v_stride = (__pyx_t_3[0]);
12448 __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_stride);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 572, __pyx_L1_error)
12449 __Pyx_GOTREF(__pyx_t_6);
12450 if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 572, __pyx_L1_error)
12451 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
12453 __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2));
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 572, __pyx_L1_error)
12454 __Pyx_GOTREF(__pyx_t_6);
12455 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12456 __pyx_r = __pyx_t_6;
12470 __Pyx_XDECREF(__pyx_t_2);
12471 __Pyx_XDECREF(__pyx_t_6);
12472 __Pyx_AddTraceback(
"View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12475 __Pyx_XGIVEREF(__pyx_r);
12476 __Pyx_RefNannyFinishContext();
12489 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self);
12490 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) {
12491 PyObject *__pyx_r = 0;
12492 __Pyx_RefNannyDeclarations
12493 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
12494 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
12497 __Pyx_RefNannyFinishContext();
12501 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
12502 Py_ssize_t __pyx_v_suboffset;
12503 PyObject *__pyx_r = NULL;
12504 __Pyx_RefNannyDeclarations
12506 PyObject *__pyx_t_2 = NULL;
12507 PyObject *__pyx_t_3 = NULL;
12508 Py_ssize_t *__pyx_t_4;
12509 Py_ssize_t *__pyx_t_5;
12510 Py_ssize_t *__pyx_t_6;
12511 int __pyx_lineno = 0;
12512 const char *__pyx_filename = NULL;
12513 int __pyx_clineno = 0;
12514 __Pyx_RefNannySetupContext(
"__get__", 0);
12523 __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0);
12533 __Pyx_XDECREF(__pyx_r);
12534 __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 577, __pyx_L1_error)
12535 __Pyx_GOTREF(__pyx_t_2);
12536 __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__19, __pyx_t_2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 577, __pyx_L1_error)
12537 __Pyx_GOTREF(__pyx_t_3);
12538 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12539 __pyx_r = __pyx_t_3;
12559 __Pyx_XDECREF(__pyx_r);
12560 __pyx_t_3 = PyList_New(0);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 579, __pyx_L1_error)
12561 __Pyx_GOTREF(__pyx_t_3);
12562 __pyx_t_5 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim);
12563 for (__pyx_t_6 = __pyx_v_self->view.suboffsets; __pyx_t_6 < __pyx_t_5; __pyx_t_6++) {
12564 __pyx_t_4 = __pyx_t_6;
12565 __pyx_v_suboffset = (__pyx_t_4[0]);
12566 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_suboffset);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 579, __pyx_L1_error)
12567 __Pyx_GOTREF(__pyx_t_2);
12568 if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(1, 579, __pyx_L1_error)
12569 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12571 __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_3));
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 579, __pyx_L1_error)
12572 __Pyx_GOTREF(__pyx_t_2);
12573 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12574 __pyx_r = __pyx_t_2;
12588 __Pyx_XDECREF(__pyx_t_2);
12589 __Pyx_XDECREF(__pyx_t_3);
12590 __Pyx_AddTraceback(
"View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12593 __Pyx_XGIVEREF(__pyx_r);
12594 __Pyx_RefNannyFinishContext();
12607 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self);
12608 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) {
12609 PyObject *__pyx_r = 0;
12610 __Pyx_RefNannyDeclarations
12611 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
12612 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
12615 __Pyx_RefNannyFinishContext();
12619 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
12620 PyObject *__pyx_r = NULL;
12621 __Pyx_RefNannyDeclarations
12622 PyObject *__pyx_t_1 = NULL;
12623 int __pyx_lineno = 0;
12624 const char *__pyx_filename = NULL;
12625 int __pyx_clineno = 0;
12626 __Pyx_RefNannySetupContext(
"__get__", 0);
12635 __Pyx_XDECREF(__pyx_r);
12636 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 583, __pyx_L1_error)
12637 __Pyx_GOTREF(__pyx_t_1);
12638 __pyx_r = __pyx_t_1;
12652 __Pyx_XDECREF(__pyx_t_1);
12653 __Pyx_AddTraceback(
"View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12656 __Pyx_XGIVEREF(__pyx_r);
12657 __Pyx_RefNannyFinishContext();
12670 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self);
12671 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) {
12672 PyObject *__pyx_r = 0;
12673 __Pyx_RefNannyDeclarations
12674 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
12675 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
12678 __Pyx_RefNannyFinishContext();
12682 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
12683 PyObject *__pyx_r = NULL;
12684 __Pyx_RefNannyDeclarations
12685 PyObject *__pyx_t_1 = NULL;
12686 int __pyx_lineno = 0;
12687 const char *__pyx_filename = NULL;
12688 int __pyx_clineno = 0;
12689 __Pyx_RefNannySetupContext(
"__get__", 0);
12698 __Pyx_XDECREF(__pyx_r);
12699 __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 587, __pyx_L1_error)
12700 __Pyx_GOTREF(__pyx_t_1);
12701 __pyx_r = __pyx_t_1;
12715 __Pyx_XDECREF(__pyx_t_1);
12716 __Pyx_AddTraceback(
"View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12719 __Pyx_XGIVEREF(__pyx_r);
12720 __Pyx_RefNannyFinishContext();
12733 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self);
12734 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) {
12735 PyObject *__pyx_r = 0;
12736 __Pyx_RefNannyDeclarations
12737 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
12738 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
12741 __Pyx_RefNannyFinishContext();
12745 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
12746 PyObject *__pyx_r = NULL;
12747 __Pyx_RefNannyDeclarations
12748 PyObject *__pyx_t_1 = NULL;
12749 PyObject *__pyx_t_2 = NULL;
12750 PyObject *__pyx_t_3 = NULL;
12751 int __pyx_lineno = 0;
12752 const char *__pyx_filename = NULL;
12753 int __pyx_clineno = 0;
12754 __Pyx_RefNannySetupContext(
"__get__", 0);
12763 __Pyx_XDECREF(__pyx_r);
12764 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 591, __pyx_L1_error)
12765 __Pyx_GOTREF(__pyx_t_1);
12766 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 591, __pyx_L1_error)
12767 __Pyx_GOTREF(__pyx_t_2);
12768 __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 591, __pyx_L1_error)
12769 __Pyx_GOTREF(__pyx_t_3);
12770 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12771 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12772 __pyx_r = __pyx_t_3;
12786 __Pyx_XDECREF(__pyx_t_1);
12787 __Pyx_XDECREF(__pyx_t_2);
12788 __Pyx_XDECREF(__pyx_t_3);
12789 __Pyx_AddTraceback(
"View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12792 __Pyx_XGIVEREF(__pyx_r);
12793 __Pyx_RefNannyFinishContext();
12806 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self);
12807 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) {
12808 PyObject *__pyx_r = 0;
12809 __Pyx_RefNannyDeclarations
12810 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
12811 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
12814 __Pyx_RefNannyFinishContext();
12818 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
12819 PyObject *__pyx_v_result = NULL;
12820 PyObject *__pyx_v_length = NULL;
12821 PyObject *__pyx_r = NULL;
12822 __Pyx_RefNannyDeclarations
12825 Py_ssize_t *__pyx_t_3;
12826 Py_ssize_t *__pyx_t_4;
12827 Py_ssize_t *__pyx_t_5;
12828 PyObject *__pyx_t_6 = NULL;
12829 int __pyx_lineno = 0;
12830 const char *__pyx_filename = NULL;
12831 int __pyx_clineno = 0;
12832 __Pyx_RefNannySetupContext(
"__get__", 0);
12841 __pyx_t_1 = (__pyx_v_self->_size == Py_None);
12842 __pyx_t_2 = (__pyx_t_1 != 0);
12852 __Pyx_INCREF(__pyx_int_1);
12853 __pyx_v_result = __pyx_int_1;
12862 __pyx_t_4 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
12863 for (__pyx_t_5 = __pyx_v_self->view.shape; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
12864 __pyx_t_3 = __pyx_t_5;
12865 __pyx_t_6 = PyInt_FromSsize_t((__pyx_t_3[0]));
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 598, __pyx_L1_error)
12866 __Pyx_GOTREF(__pyx_t_6);
12867 __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_6);
12877 __pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 599, __pyx_L1_error)
12878 __Pyx_GOTREF(__pyx_t_6);
12879 __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_6);
12890 __Pyx_INCREF(__pyx_v_result);
12891 __Pyx_GIVEREF(__pyx_v_result);
12892 __Pyx_GOTREF(__pyx_v_self->_size);
12893 __Pyx_DECREF(__pyx_v_self->_size);
12894 __pyx_v_self->_size = __pyx_v_result;
12912 __Pyx_XDECREF(__pyx_r);
12913 __Pyx_INCREF(__pyx_v_self->_size);
12914 __pyx_r = __pyx_v_self->_size;
12927 __Pyx_XDECREF(__pyx_t_6);
12928 __Pyx_AddTraceback(
"View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12931 __Pyx_XDECREF(__pyx_v_result);
12932 __Pyx_XDECREF(__pyx_v_length);
12933 __Pyx_XGIVEREF(__pyx_r);
12934 __Pyx_RefNannyFinishContext();
12947 static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self);
12948 static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) {
12949 Py_ssize_t __pyx_r;
12950 __Pyx_RefNannyDeclarations
12951 __Pyx_RefNannySetupContext(
"__len__ (wrapper)", 0);
12952 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
12955 __Pyx_RefNannyFinishContext();
12959 static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(
struct __pyx_memoryview_obj *__pyx_v_self) {
12960 Py_ssize_t __pyx_r;
12961 __Pyx_RefNannyDeclarations
12963 __Pyx_RefNannySetupContext(
"__len__", 0);
12972 __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0);
12982 __pyx_r = (__pyx_v_self->view.shape[0]);
13014 __Pyx_RefNannyFinishContext();
13027 static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self);
13028 static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) {
13029 PyObject *__pyx_r = 0;
13030 __Pyx_RefNannyDeclarations
13031 __Pyx_RefNannySetupContext(
"__repr__ (wrapper)", 0);
13032 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
13035 __Pyx_RefNannyFinishContext();
13039 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(
struct __pyx_memoryview_obj *__pyx_v_self) {
13040 PyObject *__pyx_r = NULL;
13041 __Pyx_RefNannyDeclarations
13042 PyObject *__pyx_t_1 = NULL;
13043 PyObject *__pyx_t_2 = NULL;
13044 PyObject *__pyx_t_3 = NULL;
13045 int __pyx_lineno = 0;
13046 const char *__pyx_filename = NULL;
13047 int __pyx_clineno = 0;
13048 __Pyx_RefNannySetupContext(
"__repr__", 0);
13057 __Pyx_XDECREF(__pyx_r);
13058 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 612, __pyx_L1_error)
13059 __Pyx_GOTREF(__pyx_t_1);
13060 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 612, __pyx_L1_error)
13061 __Pyx_GOTREF(__pyx_t_2);
13062 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13063 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 612, __pyx_L1_error)
13064 __Pyx_GOTREF(__pyx_t_1);
13065 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13074 __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self));
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 613, __pyx_L1_error)
13075 __Pyx_GOTREF(__pyx_t_2);
13084 __pyx_t_3 = PyTuple_New(2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 612, __pyx_L1_error)
13085 __Pyx_GOTREF(__pyx_t_3);
13086 __Pyx_GIVEREF(__pyx_t_1);
13087 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
13088 __Pyx_GIVEREF(__pyx_t_2);
13089 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
13092 __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_3);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 612, __pyx_L1_error)
13093 __Pyx_GOTREF(__pyx_t_2);
13094 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13095 __pyx_r = __pyx_t_2;
13109 __Pyx_XDECREF(__pyx_t_1);
13110 __Pyx_XDECREF(__pyx_t_2);
13111 __Pyx_XDECREF(__pyx_t_3);
13112 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13115 __Pyx_XGIVEREF(__pyx_r);
13116 __Pyx_RefNannyFinishContext();
13129 static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self);
13130 static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) {
13131 PyObject *__pyx_r = 0;
13132 __Pyx_RefNannyDeclarations
13133 __Pyx_RefNannySetupContext(
"__str__ (wrapper)", 0);
13134 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
13137 __Pyx_RefNannyFinishContext();
13141 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(
struct __pyx_memoryview_obj *__pyx_v_self) {
13142 PyObject *__pyx_r = NULL;
13143 __Pyx_RefNannyDeclarations
13144 PyObject *__pyx_t_1 = NULL;
13145 PyObject *__pyx_t_2 = NULL;
13146 int __pyx_lineno = 0;
13147 const char *__pyx_filename = NULL;
13148 int __pyx_clineno = 0;
13149 __Pyx_RefNannySetupContext(
"__str__", 0);
13158 __Pyx_XDECREF(__pyx_r);
13159 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 616, __pyx_L1_error)
13160 __Pyx_GOTREF(__pyx_t_1);
13161 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 616, __pyx_L1_error)
13162 __Pyx_GOTREF(__pyx_t_2);
13163 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13164 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 616, __pyx_L1_error)
13165 __Pyx_GOTREF(__pyx_t_1);
13166 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13167 __pyx_t_2 = PyTuple_New(1);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 616, __pyx_L1_error)
13168 __Pyx_GOTREF(__pyx_t_2);
13169 __Pyx_GIVEREF(__pyx_t_1);
13170 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
13172 __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 616, __pyx_L1_error)
13173 __Pyx_GOTREF(__pyx_t_1);
13174 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13175 __pyx_r = __pyx_t_1;
13189 __Pyx_XDECREF(__pyx_t_1);
13190 __Pyx_XDECREF(__pyx_t_2);
13191 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13194 __Pyx_XGIVEREF(__pyx_r);
13195 __Pyx_RefNannyFinishContext();
13208 static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
13209 static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
13210 PyObject *__pyx_r = 0;
13211 __Pyx_RefNannyDeclarations
13212 __Pyx_RefNannySetupContext(
"is_c_contig (wrapper)", 0);
13213 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((
struct __pyx_memoryview_obj *)__pyx_v_self));
13216 __Pyx_RefNannyFinishContext();
13220 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(
struct __pyx_memoryview_obj *__pyx_v_self) {
13221 __Pyx_memviewslice *__pyx_v_mslice;
13222 __Pyx_memviewslice __pyx_v_tmp;
13223 PyObject *__pyx_r = NULL;
13224 __Pyx_RefNannyDeclarations
13225 __Pyx_memviewslice *__pyx_t_1;
13226 PyObject *__pyx_t_2 = NULL;
13227 int __pyx_lineno = 0;
13228 const char *__pyx_filename = NULL;
13229 int __pyx_clineno = 0;
13230 __Pyx_RefNannySetupContext(
"is_c_contig", 0);
13239 __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp));
if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 622, __pyx_L1_error)
13240 __pyx_v_mslice = __pyx_t_1;
13249 __Pyx_XDECREF(__pyx_r);
13250 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]),
'C', __pyx_v_self->view.ndim));
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 623, __pyx_L1_error)
13251 __Pyx_GOTREF(__pyx_t_2);
13252 __pyx_r = __pyx_t_2;
13266 __Pyx_XDECREF(__pyx_t_2);
13267 __Pyx_AddTraceback(
"View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
13270 __Pyx_XGIVEREF(__pyx_r);
13271 __Pyx_RefNannyFinishContext();
13284 static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
13285 static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
13286 PyObject *__pyx_r = 0;
13287 __Pyx_RefNannyDeclarations
13288 __Pyx_RefNannySetupContext(
"is_f_contig (wrapper)", 0);
13289 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((
struct __pyx_memoryview_obj *)__pyx_v_self));
13292 __Pyx_RefNannyFinishContext();
13296 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(
struct __pyx_memoryview_obj *__pyx_v_self) {
13297 __Pyx_memviewslice *__pyx_v_mslice;
13298 __Pyx_memviewslice __pyx_v_tmp;
13299 PyObject *__pyx_r = NULL;
13300 __Pyx_RefNannyDeclarations
13301 __Pyx_memviewslice *__pyx_t_1;
13302 PyObject *__pyx_t_2 = NULL;
13303 int __pyx_lineno = 0;
13304 const char *__pyx_filename = NULL;
13305 int __pyx_clineno = 0;
13306 __Pyx_RefNannySetupContext(
"is_f_contig", 0);
13315 __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp));
if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 628, __pyx_L1_error)
13316 __pyx_v_mslice = __pyx_t_1;
13325 __Pyx_XDECREF(__pyx_r);
13326 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]),
'F', __pyx_v_self->view.ndim));
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 629, __pyx_L1_error)
13327 __Pyx_GOTREF(__pyx_t_2);
13328 __pyx_r = __pyx_t_2;
13342 __Pyx_XDECREF(__pyx_t_2);
13343 __Pyx_AddTraceback(
"View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
13346 __Pyx_XGIVEREF(__pyx_r);
13347 __Pyx_RefNannyFinishContext();
13360 static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
13361 static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
13362 PyObject *__pyx_r = 0;
13363 __Pyx_RefNannyDeclarations
13364 __Pyx_RefNannySetupContext(
"copy (wrapper)", 0);
13365 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((
struct __pyx_memoryview_obj *)__pyx_v_self));
13368 __Pyx_RefNannyFinishContext();
13372 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(
struct __pyx_memoryview_obj *__pyx_v_self) {
13373 __Pyx_memviewslice __pyx_v_mslice;
13375 PyObject *__pyx_r = NULL;
13376 __Pyx_RefNannyDeclarations
13377 __Pyx_memviewslice __pyx_t_1;
13378 PyObject *__pyx_t_2 = NULL;
13379 int __pyx_lineno = 0;
13380 const char *__pyx_filename = NULL;
13381 int __pyx_clineno = 0;
13382 __Pyx_RefNannySetupContext(
"copy", 0);
13391 __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS));
13400 __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice));
13409 __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((
char *)
"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object);
if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 636, __pyx_L1_error)
13410 __pyx_v_mslice = __pyx_t_1;
13419 __Pyx_XDECREF(__pyx_r);
13420 __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice));
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 641, __pyx_L1_error)
13421 __Pyx_GOTREF(__pyx_t_2);
13422 __pyx_r = __pyx_t_2;
13436 __Pyx_XDECREF(__pyx_t_2);
13437 __Pyx_AddTraceback(
"View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
13440 __Pyx_XGIVEREF(__pyx_r);
13441 __Pyx_RefNannyFinishContext();
13454 static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
13455 static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
13456 PyObject *__pyx_r = 0;
13457 __Pyx_RefNannyDeclarations
13458 __Pyx_RefNannySetupContext(
"copy_fortran (wrapper)", 0);
13459 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((
struct __pyx_memoryview_obj *)__pyx_v_self));
13462 __Pyx_RefNannyFinishContext();
13466 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(
struct __pyx_memoryview_obj *__pyx_v_self) {
13467 __Pyx_memviewslice __pyx_v_src;
13468 __Pyx_memviewslice __pyx_v_dst;
13470 PyObject *__pyx_r = NULL;
13471 __Pyx_RefNannyDeclarations
13472 __Pyx_memviewslice __pyx_t_1;
13473 PyObject *__pyx_t_2 = NULL;
13474 int __pyx_lineno = 0;
13475 const char *__pyx_filename = NULL;
13476 int __pyx_clineno = 0;
13477 __Pyx_RefNannySetupContext(
"copy_fortran", 0);
13486 __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS));
13495 __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src));
13504 __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((
char *)
"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object);
if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 648, __pyx_L1_error)
13505 __pyx_v_dst = __pyx_t_1;
13514 __Pyx_XDECREF(__pyx_r);
13515 __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst));
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 653, __pyx_L1_error)
13516 __Pyx_GOTREF(__pyx_t_2);
13517 __pyx_r = __pyx_t_2;
13531 __Pyx_XDECREF(__pyx_t_2);
13532 __Pyx_AddTraceback(
"View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename);
13535 __Pyx_XGIVEREF(__pyx_r);
13536 __Pyx_RefNannyFinishContext();
13547 static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
13548 static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
13549 PyObject *__pyx_r = 0;
13550 __Pyx_RefNannyDeclarations
13551 __Pyx_RefNannySetupContext(
"__reduce_cython__ (wrapper)", 0);
13552 __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
13555 __Pyx_RefNannyFinishContext();
13559 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED
struct __pyx_memoryview_obj *__pyx_v_self) {
13560 PyObject *__pyx_r = NULL;
13561 __Pyx_RefNannyDeclarations
13562 PyObject *__pyx_t_1 = NULL;
13563 int __pyx_lineno = 0;
13564 const char *__pyx_filename = NULL;
13565 int __pyx_clineno = 0;
13566 __Pyx_RefNannySetupContext(
"__reduce_cython__", 0);
13574 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__20, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
13575 __Pyx_GOTREF(__pyx_t_1);
13576 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
13577 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13578 __PYX_ERR(1, 2, __pyx_L1_error)
13588 __Pyx_XDECREF(__pyx_t_1);
13589 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13591 __Pyx_XGIVEREF(__pyx_r);
13592 __Pyx_RefNannyFinishContext();
13604 static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state);
13605 static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
13606 PyObject *__pyx_r = 0;
13607 __Pyx_RefNannyDeclarations
13608 __Pyx_RefNannySetupContext(
"__setstate_cython__ (wrapper)", 0);
13609 __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((
struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
13612 __Pyx_RefNannyFinishContext();
13616 static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
13617 PyObject *__pyx_r = NULL;
13618 __Pyx_RefNannyDeclarations
13619 PyObject *__pyx_t_1 = NULL;
13620 int __pyx_lineno = 0;
13621 const char *__pyx_filename = NULL;
13622 int __pyx_clineno = 0;
13623 __Pyx_RefNannySetupContext(
"__setstate_cython__", 0);
13630 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__21, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
13631 __Pyx_GOTREF(__pyx_t_1);
13632 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
13633 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13634 __PYX_ERR(1, 4, __pyx_L1_error)
13645 __Pyx_XDECREF(__pyx_t_1);
13646 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13648 __Pyx_XGIVEREF(__pyx_r);
13649 __Pyx_RefNannyFinishContext();
13661 static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o,
int __pyx_v_flags,
int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) {
13662 struct __pyx_memoryview_obj *__pyx_v_result = 0;
13663 PyObject *__pyx_r = NULL;
13664 __Pyx_RefNannyDeclarations
13665 PyObject *__pyx_t_1 = NULL;
13666 PyObject *__pyx_t_2 = NULL;
13667 PyObject *__pyx_t_3 = NULL;
13668 int __pyx_lineno = 0;
13669 const char *__pyx_filename = NULL;
13670 int __pyx_clineno = 0;
13671 __Pyx_RefNannySetupContext(
"memoryview_cwrapper", 0);
13680 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 658, __pyx_L1_error)
13681 __Pyx_GOTREF(__pyx_t_1);
13682 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 658, __pyx_L1_error)
13683 __Pyx_GOTREF(__pyx_t_2);
13684 __pyx_t_3 = PyTuple_New(3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 658, __pyx_L1_error)
13685 __Pyx_GOTREF(__pyx_t_3);
13686 __Pyx_INCREF(__pyx_v_o);
13687 __Pyx_GIVEREF(__pyx_v_o);
13688 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o);
13689 __Pyx_GIVEREF(__pyx_t_1);
13690 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
13691 __Pyx_GIVEREF(__pyx_t_2);
13692 PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
13695 __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 658, __pyx_L1_error)
13696 __Pyx_GOTREF(__pyx_t_2);
13697 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13698 __pyx_v_result = ((
struct __pyx_memoryview_obj *)__pyx_t_2);
13708 __pyx_v_result->typeinfo = __pyx_v_typeinfo;
13717 __Pyx_XDECREF(__pyx_r);
13718 __Pyx_INCREF(((PyObject *)__pyx_v_result));
13719 __pyx_r = ((PyObject *)__pyx_v_result);
13732 __Pyx_XDECREF(__pyx_t_1);
13733 __Pyx_XDECREF(__pyx_t_2);
13734 __Pyx_XDECREF(__pyx_t_3);
13735 __Pyx_AddTraceback(
"View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
13738 __Pyx_XDECREF((PyObject *)__pyx_v_result);
13739 __Pyx_XGIVEREF(__pyx_r);
13740 __Pyx_RefNannyFinishContext();
13752 static CYTHON_INLINE
int __pyx_memoryview_check(PyObject *__pyx_v_o) {
13754 __Pyx_RefNannyDeclarations
13756 __Pyx_RefNannySetupContext(
"memoryview_check", 0);
13765 __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type);
13766 __pyx_r = __pyx_t_1;
13779 __Pyx_RefNannyFinishContext();
13791 static PyObject *_unellipsify(PyObject *__pyx_v_index,
int __pyx_v_ndim) {
13792 PyObject *__pyx_v_tup = NULL;
13793 PyObject *__pyx_v_result = NULL;
13794 int __pyx_v_have_slices;
13795 int __pyx_v_seen_ellipsis;
13796 CYTHON_UNUSED PyObject *__pyx_v_idx = NULL;
13797 PyObject *__pyx_v_item = NULL;
13798 Py_ssize_t __pyx_v_nslices;
13799 PyObject *__pyx_r = NULL;
13800 __Pyx_RefNannyDeclarations
13803 PyObject *__pyx_t_3 = NULL;
13804 PyObject *__pyx_t_4 = NULL;
13805 Py_ssize_t __pyx_t_5;
13806 PyObject *(*__pyx_t_6)(PyObject *);
13807 PyObject *__pyx_t_7 = NULL;
13808 Py_ssize_t __pyx_t_8;
13811 PyObject *__pyx_t_11 = NULL;
13812 int __pyx_lineno = 0;
13813 const char *__pyx_filename = NULL;
13814 int __pyx_clineno = 0;
13815 __Pyx_RefNannySetupContext(
"_unellipsify", 0);
13824 __pyx_t_1 = PyTuple_Check(__pyx_v_index);
13825 __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
13835 __pyx_t_3 = PyTuple_New(1);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 672, __pyx_L1_error)
13836 __Pyx_GOTREF(__pyx_t_3);
13837 __Pyx_INCREF(__pyx_v_index);
13838 __Pyx_GIVEREF(__pyx_v_index);
13839 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index);
13840 __pyx_v_tup = __pyx_t_3;
13861 __Pyx_INCREF(__pyx_v_index);
13862 __pyx_v_tup = __pyx_v_index;
13873 __pyx_t_3 = PyList_New(0);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 676, __pyx_L1_error)
13874 __Pyx_GOTREF(__pyx_t_3);
13875 __pyx_v_result = ((PyObject*)__pyx_t_3);
13885 __pyx_v_have_slices = 0;
13894 __pyx_v_seen_ellipsis = 0;
13903 __Pyx_INCREF(__pyx_int_0);
13904 __pyx_t_3 = __pyx_int_0;
13905 if (likely(PyList_CheckExact(__pyx_v_tup)) || PyTuple_CheckExact(__pyx_v_tup)) {
13906 __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
13909 __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 679, __pyx_L1_error)
13910 __Pyx_GOTREF(__pyx_t_4);
13911 __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext;
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 679, __pyx_L1_error)
13914 if (likely(!__pyx_t_6)) {
13915 if (likely(PyList_CheckExact(__pyx_t_4))) {
13916 if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4))
break;
13917 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13918 __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++;
if (unlikely(0 < 0)) __PYX_ERR(1, 679, __pyx_L1_error)
13920 __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++;
if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 679, __pyx_L1_error)
13921 __Pyx_GOTREF(__pyx_t_7);
13924 if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4))
break;
13925 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13926 __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++;
if (unlikely(0 < 0)) __PYX_ERR(1, 679, __pyx_L1_error)
13928 __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++;
if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 679, __pyx_L1_error)
13929 __Pyx_GOTREF(__pyx_t_7);
13933 __pyx_t_7 = __pyx_t_6(__pyx_t_4);
13934 if (unlikely(!__pyx_t_7)) {
13935 PyObject* exc_type = PyErr_Occurred();
13937 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
13938 else __PYX_ERR(1, 679, __pyx_L1_error)
13942 __Pyx_GOTREF(__pyx_t_7);
13944 __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
13946 __Pyx_INCREF(__pyx_t_3);
13947 __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3);
13948 __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0);
if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 679, __pyx_L1_error)
13949 __Pyx_GOTREF(__pyx_t_7);
13950 __Pyx_DECREF(__pyx_t_3);
13951 __pyx_t_3 = __pyx_t_7;
13961 __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
13962 __pyx_t_1 = (__pyx_t_2 != 0);
13972 __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0);
13982 __pyx_t_8 = PyObject_Length(__pyx_v_tup);
if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(1, 682, __pyx_L1_error)
13983 __pyx_t_7 = PyList_New(1 * ((((__pyx_v_ndim - __pyx_t_8) + 1)<0) ? 0:((__pyx_v_ndim - __pyx_t_8) + 1)));
if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 682, __pyx_L1_error)
13984 __Pyx_GOTREF(__pyx_t_7);
13985 { Py_ssize_t __pyx_temp;
13986 for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) {
13987 __Pyx_INCREF(__pyx_slice__22);
13988 __Pyx_GIVEREF(__pyx_slice__22);
13989 PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__22);
13992 __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_7);
if (unlikely(__pyx_t_9 == ((
int)-1))) __PYX_ERR(1, 682, __pyx_L1_error)
13993 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
14002 __pyx_v_seen_ellipsis = 1;
14022 __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__22);
if (unlikely(__pyx_t_9 == ((
int)-1))) __PYX_ERR(1, 685, __pyx_L1_error)
14033 __pyx_v_have_slices = 1;
14053 __pyx_t_2 = PySlice_Check(__pyx_v_item);
14054 __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0);
14057 __pyx_t_1 = __pyx_t_10;
14058 goto __pyx_L9_bool_binop_done;
14060 __pyx_t_10 = ((!(PyIndex_Check(__pyx_v_item) != 0)) != 0);
14061 __pyx_t_1 = __pyx_t_10;
14062 __pyx_L9_bool_binop_done:;
14063 if (unlikely(__pyx_t_1)) {
14072 __pyx_t_7 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Cannot_index_with_type_s, ((PyObject *)Py_TYPE(__pyx_v_item)));
if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 689, __pyx_L1_error)
14073 __Pyx_GOTREF(__pyx_t_7);
14074 __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7);
if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 689, __pyx_L1_error)
14075 __Pyx_GOTREF(__pyx_t_11);
14076 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
14077 __Pyx_Raise(__pyx_t_11, 0, 0, 0);
14078 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
14079 __PYX_ERR(1, 689, __pyx_L1_error)
14097 __pyx_t_10 = (__pyx_v_have_slices != 0);
14100 __pyx_t_1 = __pyx_t_10;
14101 goto __pyx_L11_bool_binop_done;
14103 __pyx_t_10 = PySlice_Check(__pyx_v_item);
14104 __pyx_t_2 = (__pyx_t_10 != 0);
14105 __pyx_t_1 = __pyx_t_2;
14106 __pyx_L11_bool_binop_done:;
14107 __pyx_v_have_slices = __pyx_t_1;
14116 __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item);
if (unlikely(__pyx_t_9 == ((
int)-1))) __PYX_ERR(1, 692, __pyx_L1_error)
14128 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14129 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14138 __pyx_t_5 = PyList_GET_SIZE(__pyx_v_result);
if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 694, __pyx_L1_error)
14139 __pyx_v_nslices = (__pyx_v_ndim - __pyx_t_5);
14148 __pyx_t_1 = (__pyx_v_nslices != 0);
14158 __pyx_t_3 = PyList_New(1 * ((__pyx_v_nslices<0) ? 0:__pyx_v_nslices));
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 696, __pyx_L1_error)
14159 __Pyx_GOTREF(__pyx_t_3);
14160 { Py_ssize_t __pyx_temp;
14161 for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) {
14162 __Pyx_INCREF(__pyx_slice__22);
14163 __Pyx_GIVEREF(__pyx_slice__22);
14164 PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__22);
14167 __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_3);
if (unlikely(__pyx_t_9 == ((
int)-1))) __PYX_ERR(1, 696, __pyx_L1_error)
14168 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14186 __Pyx_XDECREF(__pyx_r);
14187 if (!__pyx_v_have_slices) {
14189 __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 698, __pyx_L1_error)
14190 __Pyx_GOTREF(__pyx_t_4);
14191 __pyx_t_3 = __pyx_t_4;
14193 goto __pyx_L14_bool_binop_done;
14195 __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nslices);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 698, __pyx_L1_error)
14196 __Pyx_GOTREF(__pyx_t_4);
14197 __pyx_t_3 = __pyx_t_4;
14199 __pyx_L14_bool_binop_done:;
14200 __pyx_t_4 = PyList_AsTuple(__pyx_v_result);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 698, __pyx_L1_error)
14201 __Pyx_GOTREF(__pyx_t_4);
14202 __pyx_t_11 = PyTuple_New(2);
if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 698, __pyx_L1_error)
14203 __Pyx_GOTREF(__pyx_t_11);
14204 __Pyx_GIVEREF(__pyx_t_3);
14205 PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3);
14206 __Pyx_GIVEREF(__pyx_t_4);
14207 PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_4);
14210 __pyx_r = ((PyObject*)__pyx_t_11);
14224 __Pyx_XDECREF(__pyx_t_3);
14225 __Pyx_XDECREF(__pyx_t_4);
14226 __Pyx_XDECREF(__pyx_t_7);
14227 __Pyx_XDECREF(__pyx_t_11);
14228 __Pyx_AddTraceback(
"View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename);
14231 __Pyx_XDECREF(__pyx_v_tup);
14232 __Pyx_XDECREF(__pyx_v_result);
14233 __Pyx_XDECREF(__pyx_v_idx);
14234 __Pyx_XDECREF(__pyx_v_item);
14235 __Pyx_XGIVEREF(__pyx_r);
14236 __Pyx_RefNannyFinishContext();
14248 static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets,
int __pyx_v_ndim) {
14249 Py_ssize_t __pyx_v_suboffset;
14250 PyObject *__pyx_r = NULL;
14251 __Pyx_RefNannyDeclarations
14252 Py_ssize_t *__pyx_t_1;
14253 Py_ssize_t *__pyx_t_2;
14254 Py_ssize_t *__pyx_t_3;
14256 PyObject *__pyx_t_5 = NULL;
14257 int __pyx_lineno = 0;
14258 const char *__pyx_filename = NULL;
14259 int __pyx_clineno = 0;
14260 __Pyx_RefNannySetupContext(
"assert_direct_dimensions", 0);
14269 __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim);
14270 for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) {
14271 __pyx_t_1 = __pyx_t_3;
14272 __pyx_v_suboffset = (__pyx_t_1[0]);
14281 __pyx_t_4 = ((__pyx_v_suboffset >= 0) != 0);
14282 if (unlikely(__pyx_t_4)) {
14291 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__23, NULL);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 703, __pyx_L1_error)
14292 __Pyx_GOTREF(__pyx_t_5);
14293 __Pyx_Raise(__pyx_t_5, 0, 0, 0);
14294 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14295 __PYX_ERR(1, 703, __pyx_L1_error)
14316 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
14319 __Pyx_XDECREF(__pyx_t_5);
14320 __Pyx_AddTraceback(
"View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename);
14323 __Pyx_XGIVEREF(__pyx_r);
14324 __Pyx_RefNannyFinishContext();
14336 static struct __pyx_memoryview_obj *__pyx_memview_slice(
struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) {
14337 int __pyx_v_new_ndim;
14338 int __pyx_v_suboffset_dim;
14340 __Pyx_memviewslice __pyx_v_src;
14341 __Pyx_memviewslice __pyx_v_dst;
14342 __Pyx_memviewslice *__pyx_v_p_src;
14343 struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0;
14344 __Pyx_memviewslice *__pyx_v_p_dst;
14345 int *__pyx_v_p_suboffset_dim;
14346 Py_ssize_t __pyx_v_start;
14347 Py_ssize_t __pyx_v_stop;
14348 Py_ssize_t __pyx_v_step;
14349 int __pyx_v_have_start;
14350 int __pyx_v_have_stop;
14351 int __pyx_v_have_step;
14352 PyObject *__pyx_v_index = NULL;
14353 struct __pyx_memoryview_obj *__pyx_r = NULL;
14354 __Pyx_RefNannyDeclarations
14357 PyObject *__pyx_t_3 = NULL;
14358 struct __pyx_memoryview_obj *__pyx_t_4;
14361 Py_ssize_t __pyx_t_7;
14362 PyObject *(*__pyx_t_8)(PyObject *);
14363 PyObject *__pyx_t_9 = NULL;
14364 Py_ssize_t __pyx_t_10;
14366 Py_ssize_t __pyx_t_12;
14367 int __pyx_lineno = 0;
14368 const char *__pyx_filename = NULL;
14369 int __pyx_clineno = 0;
14370 __Pyx_RefNannySetupContext(
"memview_slice", 0);
14379 __pyx_v_new_ndim = 0;
14380 __pyx_v_suboffset_dim = -1;
14389 (void)(memset((&__pyx_v_dst), 0, (
sizeof(__pyx_v_dst))));
14398 #ifndef CYTHON_WITHOUT_ASSERTIONS
14399 if (unlikely(!Py_OptimizeFlag)) {
14400 if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) {
14401 PyErr_SetNone(PyExc_AssertionError);
14402 __PYX_ERR(1, 722, __pyx_L1_error)
14414 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
14415 __pyx_t_2 = (__pyx_t_1 != 0);
14425 if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(1, 725, __pyx_L1_error)
14426 __pyx_t_3 = ((PyObject *)__pyx_v_memview);
14427 __Pyx_INCREF(__pyx_t_3);
14428 __pyx_v_memviewsliceobj = ((
struct __pyx_memoryviewslice_obj *)__pyx_t_3);
14438 __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice);
14458 __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src));
14467 __pyx_v_p_src = (&__pyx_v_src);
14478 __pyx_t_4 = __pyx_v_p_src->memview;
14479 __pyx_v_dst.memview = __pyx_t_4;
14488 __pyx_t_5 = __pyx_v_p_src->data;
14489 __pyx_v_dst.data = __pyx_t_5;
14498 __pyx_v_p_dst = (&__pyx_v_dst);
14507 __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim);
14517 if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) {
14518 __pyx_t_3 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0;
14521 __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 746, __pyx_L1_error)
14522 __Pyx_GOTREF(__pyx_t_3);
14523 __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext;
if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 746, __pyx_L1_error)
14526 if (likely(!__pyx_t_8)) {
14527 if (likely(PyList_CheckExact(__pyx_t_3))) {
14528 if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3))
break;
14529 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14530 __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++;
if (unlikely(0 < 0)) __PYX_ERR(1, 746, __pyx_L1_error)
14532 __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++;
if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 746, __pyx_L1_error)
14533 __Pyx_GOTREF(__pyx_t_9);
14536 if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3))
break;
14537 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14538 __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++;
if (unlikely(0 < 0)) __PYX_ERR(1, 746, __pyx_L1_error)
14540 __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++;
if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 746, __pyx_L1_error)
14541 __Pyx_GOTREF(__pyx_t_9);
14545 __pyx_t_9 = __pyx_t_8(__pyx_t_3);
14546 if (unlikely(!__pyx_t_9)) {
14547 PyObject* exc_type = PyErr_Occurred();
14549 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
14550 else __PYX_ERR(1, 746, __pyx_L1_error)
14554 __Pyx_GOTREF(__pyx_t_9);
14556 __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9);
14558 __pyx_v_dim = __pyx_t_6;
14559 __pyx_t_6 = (__pyx_t_6 + 1);
14568 __pyx_t_2 = (PyIndex_Check(__pyx_v_index) != 0);
14578 __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index);
if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 751, __pyx_L1_error)
14587 __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0);
if (unlikely(__pyx_t_11 == ((
int)-1))) __PYX_ERR(1, 748, __pyx_L1_error)
14606 __pyx_t_2 = (__pyx_v_index == Py_None);
14607 __pyx_t_1 = (__pyx_t_2 != 0);
14617 (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1;
14626 (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0;
14635 (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1
L;
14644 __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
14664 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start);
if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 760, __pyx_L1_error)
14665 __Pyx_GOTREF(__pyx_t_9);
14666 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 760, __pyx_L1_error)
14668 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14670 __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9);
if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 760, __pyx_L1_error)
14671 __pyx_t_10 = __pyx_t_12;
14672 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14673 goto __pyx_L7_bool_binop_done;
14676 __pyx_L7_bool_binop_done:;
14677 __pyx_v_start = __pyx_t_10;
14686 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop);
if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 761, __pyx_L1_error)
14687 __Pyx_GOTREF(__pyx_t_9);
14688 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 761, __pyx_L1_error)
14690 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14692 __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9);
if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 761, __pyx_L1_error)
14693 __pyx_t_10 = __pyx_t_12;
14694 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14695 goto __pyx_L9_bool_binop_done;
14698 __pyx_L9_bool_binop_done:;
14699 __pyx_v_stop = __pyx_t_10;
14708 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step);
if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 762, __pyx_L1_error)
14709 __Pyx_GOTREF(__pyx_t_9);
14710 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 762, __pyx_L1_error)
14712 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14714 __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9);
if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 762, __pyx_L1_error)
14715 __pyx_t_10 = __pyx_t_12;
14716 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14717 goto __pyx_L11_bool_binop_done;
14720 __pyx_L11_bool_binop_done:;
14721 __pyx_v_step = __pyx_t_10;
14730 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start);
if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 764, __pyx_L1_error)
14731 __Pyx_GOTREF(__pyx_t_9);
14732 __pyx_t_1 = (__pyx_t_9 != Py_None);
14733 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14734 __pyx_v_have_start = __pyx_t_1;
14743 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop);
if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 765, __pyx_L1_error)
14744 __Pyx_GOTREF(__pyx_t_9);
14745 __pyx_t_1 = (__pyx_t_9 != Py_None);
14746 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14747 __pyx_v_have_stop = __pyx_t_1;
14756 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step);
if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 766, __pyx_L1_error)
14757 __Pyx_GOTREF(__pyx_t_9);
14758 __pyx_t_1 = (__pyx_t_9 != Py_None);
14759 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14760 __pyx_v_have_step = __pyx_t_1;
14769 __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1);
if (unlikely(__pyx_t_11 == ((
int)-1))) __PYX_ERR(1, 768, __pyx_L1_error)
14778 __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
14790 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14799 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
14800 __pyx_t_2 = (__pyx_t_1 != 0);
14810 __Pyx_XDECREF(((PyObject *)__pyx_r));
14819 if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError(
"memviewsliceobj"); __PYX_ERR(1, 778, __pyx_L1_error) }
14828 if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError(
"memviewsliceobj"); __PYX_ERR(1, 779, __pyx_L1_error) }
14837 __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 777, __pyx_L1_error)
14838 __Pyx_GOTREF(__pyx_t_3);
14839 if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(1, 777, __pyx_L1_error)
14840 __pyx_r = ((
struct __pyx_memoryview_obj *)__pyx_t_3);
14861 __Pyx_XDECREF(((PyObject *)__pyx_r));
14870 __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 782, __pyx_L1_error)
14871 __Pyx_GOTREF(__pyx_t_3);
14880 if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(1, 782, __pyx_L1_error)
14881 __pyx_r = ((
struct __pyx_memoryview_obj *)__pyx_t_3);
14896 __Pyx_XDECREF(__pyx_t_3);
14897 __Pyx_XDECREF(__pyx_t_9);
14898 __Pyx_AddTraceback(
"View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
14901 __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj);
14902 __Pyx_XDECREF(__pyx_v_index);
14903 __Pyx_XGIVEREF((PyObject *)__pyx_r);
14904 __Pyx_RefNannyFinishContext();
14916 static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset,
int __pyx_v_dim,
int __pyx_v_new_ndim,
int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step,
int __pyx_v_have_start,
int __pyx_v_have_stop,
int __pyx_v_have_step,
int __pyx_v_is_slice) {
14917 Py_ssize_t __pyx_v_new_shape;
14918 int __pyx_v_negative_step;
14923 int __pyx_lineno = 0;
14924 const char *__pyx_filename = NULL;
14925 int __pyx_clineno = 0;
14934 __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0);
14944 __pyx_t_1 = ((__pyx_v_start < 0) != 0);
14954 __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
14972 __pyx_t_1 = (0 <= __pyx_v_start);
14974 __pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
14976 __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
14986 __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((
char *)
"Index out of bounds (axis %d)"), __pyx_v_dim);
if (unlikely(__pyx_t_3 == ((
int)-1))) __PYX_ERR(1, 832, __pyx_L1_error)
15015 __pyx_t_1 = ((__pyx_v_have_step != 0) != 0);
15018 __pyx_t_2 = __pyx_t_1;
15019 goto __pyx_L6_bool_binop_done;
15021 __pyx_t_1 = ((__pyx_v_step < 0) != 0);
15022 __pyx_t_2 = __pyx_t_1;
15023 __pyx_L6_bool_binop_done:;
15024 __pyx_v_negative_step = __pyx_t_2;
15033 __pyx_t_1 = (__pyx_v_have_step != 0);
15036 __pyx_t_2 = __pyx_t_1;
15037 goto __pyx_L9_bool_binop_done;
15039 __pyx_t_1 = ((__pyx_v_step == 0) != 0);
15040 __pyx_t_2 = __pyx_t_1;
15041 __pyx_L9_bool_binop_done:;
15051 __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((
char *)
"Step may not be zero (axis %d)"), __pyx_v_dim);
if (unlikely(__pyx_t_3 == ((
int)-1))) __PYX_ERR(1, 838, __pyx_L1_error)
15069 __pyx_t_2 = (__pyx_v_have_start != 0);
15079 __pyx_t_2 = ((__pyx_v_start < 0) != 0);
15089 __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
15098 __pyx_t_2 = ((__pyx_v_start < 0) != 0);
15136 __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0);
15146 __pyx_t_2 = (__pyx_v_negative_step != 0);
15156 __pyx_v_start = (__pyx_v_shape - 1);
15176 __pyx_v_start = __pyx_v_shape;
15208 __pyx_t_2 = (__pyx_v_negative_step != 0);
15218 __pyx_v_start = (__pyx_v_shape - 1);
15251 __pyx_t_2 = (__pyx_v_have_stop != 0);
15261 __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
15271 __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape);
15280 __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
15318 __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0);
15328 __pyx_v_stop = __pyx_v_shape;
15358 __pyx_t_2 = (__pyx_v_negative_step != 0);
15368 __pyx_v_stop = -1
L;
15388 __pyx_v_stop = __pyx_v_shape;
15401 __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0);
15429 __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step);
15438 __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0);
15448 __pyx_v_new_shape = (__pyx_v_new_shape + 1);
15466 __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0);
15476 __pyx_v_new_shape = 0;
15494 (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step);
15503 (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape;
15512 (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset;
15523 __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0);
15533 __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride));
15553 __pyx_t_3 = (__pyx_v_suboffset_dim[0]);
15554 (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride));
15565 __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
15575 __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0);
15585 __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0);
15595 __pyx_v_dst->data = ((((
char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset);
15623 __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((
char *)
"All dimensions preceding dimension %d must be indexed and not sliced"), __pyx_v_dim);
if (unlikely(__pyx_t_3 == ((
int)-1))) __PYX_ERR(1, 899, __pyx_L1_error)
15645 (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim;
15680 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
15682 __Pyx_AddTraceback(
"View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
15684 __Pyx_PyGILState_Release(__pyx_gilstate_save);
15700 static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view,
char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) {
15701 Py_ssize_t __pyx_v_shape;
15702 Py_ssize_t __pyx_v_stride;
15703 Py_ssize_t __pyx_v_suboffset;
15704 Py_ssize_t __pyx_v_itemsize;
15705 char *__pyx_v_resultp;
15707 __Pyx_RefNannyDeclarations
15708 Py_ssize_t __pyx_t_1;
15710 PyObject *__pyx_t_3 = NULL;
15711 PyObject *__pyx_t_4 = NULL;
15712 int __pyx_lineno = 0;
15713 const char *__pyx_filename = NULL;
15714 int __pyx_clineno = 0;
15715 __Pyx_RefNannySetupContext(
"pybuffer_index", 0);
15724 __pyx_v_suboffset = -1
L;
15733 __pyx_t_1 = __pyx_v_view->itemsize;
15734 __pyx_v_itemsize = __pyx_t_1;
15743 __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0);
15753 if (unlikely(__pyx_v_itemsize == 0)) {
15754 PyErr_SetString(PyExc_ZeroDivisionError,
"integer division or modulo by zero");
15755 __PYX_ERR(1, 917, __pyx_L1_error)
15757 else if (
sizeof(Py_ssize_t) ==
sizeof(
long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) {
15758 PyErr_SetString(PyExc_OverflowError,
"value too large to perform division");
15759 __PYX_ERR(1, 917, __pyx_L1_error)
15761 __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize);
15770 __pyx_v_stride = __pyx_v_itemsize;
15790 __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]);
15799 __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]);
15808 __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0);
15818 __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]);
15838 __pyx_t_2 = ((__pyx_v_index < 0) != 0);
15848 __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim]));
15857 __pyx_t_2 = ((__pyx_v_index < 0) != 0);
15858 if (unlikely(__pyx_t_2)) {
15867 __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 928, __pyx_L1_error)
15868 __Pyx_GOTREF(__pyx_t_3);
15869 __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 928, __pyx_L1_error)
15870 __Pyx_GOTREF(__pyx_t_4);
15871 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15872 __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 928, __pyx_L1_error)
15873 __Pyx_GOTREF(__pyx_t_3);
15874 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15875 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
15876 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15877 __PYX_ERR(1, 928, __pyx_L1_error)
15904 __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0);
15905 if (unlikely(__pyx_t_2)) {
15914 __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 931, __pyx_L1_error)
15915 __Pyx_GOTREF(__pyx_t_3);
15916 __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 931, __pyx_L1_error)
15917 __Pyx_GOTREF(__pyx_t_4);
15918 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15919 __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 931, __pyx_L1_error)
15920 __Pyx_GOTREF(__pyx_t_3);
15921 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15922 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
15923 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15924 __PYX_ERR(1, 931, __pyx_L1_error)
15942 __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride));
15951 __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
15961 __pyx_v_resultp = ((((
char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset);
15979 __pyx_r = __pyx_v_resultp;
15992 __Pyx_XDECREF(__pyx_t_3);
15993 __Pyx_XDECREF(__pyx_t_4);
15994 __Pyx_AddTraceback(
"View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
15997 __Pyx_RefNannyFinishContext();
16009 static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
16011 Py_ssize_t *__pyx_v_shape;
16012 Py_ssize_t *__pyx_v_strides;
16017 Py_ssize_t *__pyx_t_2;
16020 Py_ssize_t __pyx_t_5;
16021 Py_ssize_t __pyx_t_6;
16025 int __pyx_lineno = 0;
16026 const char *__pyx_filename = NULL;
16027 int __pyx_clineno = 0;
16036 __pyx_t_1 = __pyx_v_memslice->memview->view.ndim;
16037 __pyx_v_ndim = __pyx_t_1;
16046 __pyx_t_2 = __pyx_v_memslice->shape;
16047 __pyx_v_shape = __pyx_t_2;
16056 __pyx_t_2 = __pyx_v_memslice->strides;
16057 __pyx_v_strides = __pyx_t_2;
16066 __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2);
16067 __pyx_t_4 = __pyx_t_3;
16068 for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) {
16069 __pyx_v_i = __pyx_t_1;
16078 __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i);
16087 __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]);
16088 __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]);
16089 (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5;
16090 (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6;
16099 __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]);
16100 __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]);
16101 (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6;
16102 (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5;
16111 __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0);
16114 __pyx_t_7 = __pyx_t_8;
16115 goto __pyx_L6_bool_binop_done;
16117 __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0);
16118 __pyx_t_7 = __pyx_t_8;
16119 __pyx_L6_bool_binop_done:;
16129 __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, ((
char *)
"Cannot transpose memoryview with indirect dimensions"));
if (unlikely(__pyx_t_9 == ((
int)-1))) __PYX_ERR(1, 957, __pyx_L1_error)
16163 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
16165 __Pyx_AddTraceback(
"View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
16167 __Pyx_PyGILState_Release(__pyx_gilstate_save);
16184 static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self);
16185 static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) {
16186 __Pyx_RefNannyDeclarations
16187 __Pyx_RefNannySetupContext(
"__dealloc__ (wrapper)", 0);
16188 __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((
struct __pyx_memoryviewslice_obj *)__pyx_v_self));
16191 __Pyx_RefNannyFinishContext();
16194 static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(
struct __pyx_memoryviewslice_obj *__pyx_v_self) {
16195 __Pyx_RefNannyDeclarations
16196 __Pyx_RefNannySetupContext(
"__dealloc__", 0);
16205 __PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1);
16216 __Pyx_RefNannyFinishContext();
16227 static PyObject *__pyx_memoryviewslice_convert_item_to_object(
struct __pyx_memoryviewslice_obj *__pyx_v_self,
char *__pyx_v_itemp) {
16228 PyObject *__pyx_r = NULL;
16229 __Pyx_RefNannyDeclarations
16231 PyObject *__pyx_t_2 = NULL;
16232 int __pyx_lineno = 0;
16233 const char *__pyx_filename = NULL;
16234 int __pyx_clineno = 0;
16235 __Pyx_RefNannySetupContext(
"convert_item_to_object", 0);
16244 __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0);
16254 __Pyx_XDECREF(__pyx_r);
16255 __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 981, __pyx_L1_error)
16256 __Pyx_GOTREF(__pyx_t_2);
16257 __pyx_r = __pyx_t_2;
16278 __Pyx_XDECREF(__pyx_r);
16279 __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((
struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 983, __pyx_L1_error)
16280 __Pyx_GOTREF(__pyx_t_2);
16281 __pyx_r = __pyx_t_2;
16296 __Pyx_XDECREF(__pyx_t_2);
16297 __Pyx_AddTraceback(
"View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
16300 __Pyx_XGIVEREF(__pyx_r);
16301 __Pyx_RefNannyFinishContext();
16313 static PyObject *__pyx_memoryviewslice_assign_item_from_object(
struct __pyx_memoryviewslice_obj *__pyx_v_self,
char *__pyx_v_itemp, PyObject *__pyx_v_value) {
16314 PyObject *__pyx_r = NULL;
16315 __Pyx_RefNannyDeclarations
16318 PyObject *__pyx_t_3 = NULL;
16319 int __pyx_lineno = 0;
16320 const char *__pyx_filename = NULL;
16321 int __pyx_clineno = 0;
16322 __Pyx_RefNannySetupContext(
"assign_item_from_object", 0);
16331 __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0);
16341 __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value);
if (unlikely(__pyx_t_2 == ((
int)0))) __PYX_ERR(1, 987, __pyx_L1_error)
16361 __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((
struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 989, __pyx_L1_error)
16362 __Pyx_GOTREF(__pyx_t_3);
16363 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16376 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
16379 __Pyx_XDECREF(__pyx_t_3);
16380 __Pyx_AddTraceback(
"View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
16383 __Pyx_XGIVEREF(__pyx_r);
16384 __Pyx_RefNannyFinishContext();
16397 static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self);
16398 static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self) {
16399 PyObject *__pyx_r = 0;
16400 __Pyx_RefNannyDeclarations
16401 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
16402 __pyx_r = __pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(((
struct __pyx_memoryviewslice_obj *)__pyx_v_self));
16405 __Pyx_RefNannyFinishContext();
16409 static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(
struct __pyx_memoryviewslice_obj *__pyx_v_self) {
16410 PyObject *__pyx_r = NULL;
16411 __Pyx_RefNannyDeclarations
16412 __Pyx_RefNannySetupContext(
"__get__", 0);
16421 __Pyx_XDECREF(__pyx_r);
16422 __Pyx_INCREF(__pyx_v_self->from_object);
16423 __pyx_r = __pyx_v_self->from_object;
16436 __Pyx_XGIVEREF(__pyx_r);
16437 __Pyx_RefNannyFinishContext();
16448 static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
16449 static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
16450 PyObject *__pyx_r = 0;
16451 __Pyx_RefNannyDeclarations
16452 __Pyx_RefNannySetupContext(
"__reduce_cython__ (wrapper)", 0);
16453 __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((
struct __pyx_memoryviewslice_obj *)__pyx_v_self));
16456 __Pyx_RefNannyFinishContext();
16460 static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED
struct __pyx_memoryviewslice_obj *__pyx_v_self) {
16461 PyObject *__pyx_r = NULL;
16462 __Pyx_RefNannyDeclarations
16463 PyObject *__pyx_t_1 = NULL;
16464 int __pyx_lineno = 0;
16465 const char *__pyx_filename = NULL;
16466 int __pyx_clineno = 0;
16467 __Pyx_RefNannySetupContext(
"__reduce_cython__", 0);
16475 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__24, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
16476 __Pyx_GOTREF(__pyx_t_1);
16477 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
16478 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16479 __PYX_ERR(1, 2, __pyx_L1_error)
16489 __Pyx_XDECREF(__pyx_t_1);
16490 __Pyx_AddTraceback(
"View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16492 __Pyx_XGIVEREF(__pyx_r);
16493 __Pyx_RefNannyFinishContext();
16505 static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state);
16506 static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
16507 PyObject *__pyx_r = 0;
16508 __Pyx_RefNannyDeclarations
16509 __Pyx_RefNannySetupContext(
"__setstate_cython__ (wrapper)", 0);
16510 __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((
struct __pyx_memoryviewslice_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
16513 __Pyx_RefNannyFinishContext();
16517 static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
16518 PyObject *__pyx_r = NULL;
16519 __Pyx_RefNannyDeclarations
16520 PyObject *__pyx_t_1 = NULL;
16521 int __pyx_lineno = 0;
16522 const char *__pyx_filename = NULL;
16523 int __pyx_clineno = 0;
16524 __Pyx_RefNannySetupContext(
"__setstate_cython__", 0);
16531 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__25, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
16532 __Pyx_GOTREF(__pyx_t_1);
16533 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
16534 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16535 __PYX_ERR(1, 4, __pyx_L1_error)
16546 __Pyx_XDECREF(__pyx_t_1);
16547 __Pyx_AddTraceback(
"View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16549 __Pyx_XGIVEREF(__pyx_r);
16550 __Pyx_RefNannyFinishContext();
16562 static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice,
int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(
char *),
int (*__pyx_v_to_dtype_func)(
char *, PyObject *),
int __pyx_v_dtype_is_object) {
16563 struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
16564 Py_ssize_t __pyx_v_suboffset;
16565 PyObject *__pyx_v_length = NULL;
16566 PyObject *__pyx_r = NULL;
16567 __Pyx_RefNannyDeclarations
16569 PyObject *__pyx_t_2 = NULL;
16570 PyObject *__pyx_t_3 = NULL;
16571 __Pyx_TypeInfo *__pyx_t_4;
16572 Py_buffer __pyx_t_5;
16573 Py_ssize_t *__pyx_t_6;
16574 Py_ssize_t *__pyx_t_7;
16575 Py_ssize_t *__pyx_t_8;
16576 Py_ssize_t __pyx_t_9;
16577 int __pyx_lineno = 0;
16578 const char *__pyx_filename = NULL;
16579 int __pyx_clineno = 0;
16580 __Pyx_RefNannySetupContext(
"memoryview_fromslice", 0);
16589 __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0);
16599 __Pyx_XDECREF(__pyx_r);
16600 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
16619 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1013, __pyx_L1_error)
16620 __Pyx_GOTREF(__pyx_t_2);
16621 __pyx_t_3 = PyTuple_New(3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1013, __pyx_L1_error)
16622 __Pyx_GOTREF(__pyx_t_3);
16623 __Pyx_INCREF(Py_None);
16624 __Pyx_GIVEREF(Py_None);
16625 PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
16626 __Pyx_INCREF(__pyx_int_0);
16627 __Pyx_GIVEREF(__pyx_int_0);
16628 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
16629 __Pyx_GIVEREF(__pyx_t_2);
16630 PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
16632 __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1013, __pyx_L1_error)
16633 __Pyx_GOTREF(__pyx_t_2);
16634 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16635 __pyx_v_result = ((
struct __pyx_memoryviewslice_obj *)__pyx_t_2);
16645 __pyx_v_result->from_slice = __pyx_v_memviewslice;
16654 __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1);
16663 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s_base);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1018, __pyx_L1_error)
16664 __Pyx_GOTREF(__pyx_t_2);
16665 __Pyx_GIVEREF(__pyx_t_2);
16666 __Pyx_GOTREF(__pyx_v_result->from_object);
16667 __Pyx_DECREF(__pyx_v_result->from_object);
16668 __pyx_v_result->from_object = __pyx_t_2;
16678 __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo;
16679 __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4;
16688 __pyx_t_5 = __pyx_v_memviewslice.memview->view;
16689 __pyx_v_result->__pyx_base.view = __pyx_t_5;
16698 __pyx_v_result->__pyx_base.view.buf = ((
void *)__pyx_v_memviewslice.data);
16707 __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim;
16716 ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None;
16725 Py_INCREF(Py_None);
16734 __pyx_t_1 = ((((
struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0);
16744 __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS;
16764 __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO;
16775 __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape);
16784 __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides);
16793 __pyx_v_result->__pyx_base.view.suboffsets = NULL;
16802 __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim);
16803 for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
16804 __pyx_t_6 = __pyx_t_8;
16805 __pyx_v_suboffset = (__pyx_t_6[0]);
16814 __pyx_t_1 = ((__pyx_v_suboffset >= 0) != 0);
16824 __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets);
16833 goto __pyx_L6_break;
16853 __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize;
16854 __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
16863 __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim);
16864 for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
16865 __pyx_t_6 = __pyx_t_8;
16866 __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0]));
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1043, __pyx_L1_error)
16867 __Pyx_GOTREF(__pyx_t_2);
16868 __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2);
16878 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1044, __pyx_L1_error)
16879 __Pyx_GOTREF(__pyx_t_2);
16880 __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1044, __pyx_L1_error)
16881 __Pyx_GOTREF(__pyx_t_3);
16882 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16883 __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3);
if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 1044, __pyx_L1_error)
16884 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16885 __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
16895 __pyx_v_result->to_object_func = __pyx_v_to_object_func;
16904 __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func;
16913 __Pyx_XDECREF(__pyx_r);
16914 __Pyx_INCREF(((PyObject *)__pyx_v_result));
16915 __pyx_r = ((PyObject *)__pyx_v_result);
16928 __Pyx_XDECREF(__pyx_t_2);
16929 __Pyx_XDECREF(__pyx_t_3);
16930 __Pyx_AddTraceback(
"View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
16933 __Pyx_XDECREF((PyObject *)__pyx_v_result);
16934 __Pyx_XDECREF(__pyx_v_length);
16935 __Pyx_XGIVEREF(__pyx_r);
16936 __Pyx_RefNannyFinishContext();
16948 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(
struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) {
16949 struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0;
16950 __Pyx_memviewslice *__pyx_r;
16951 __Pyx_RefNannyDeclarations
16954 PyObject *__pyx_t_3 = NULL;
16955 int __pyx_lineno = 0;
16956 const char *__pyx_filename = NULL;
16957 int __pyx_clineno = 0;
16958 __Pyx_RefNannySetupContext(
"get_slice_from_memview", 0);
16967 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
16968 __pyx_t_2 = (__pyx_t_1 != 0);
16978 if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(1, 1056, __pyx_L1_error)
16979 __pyx_t_3 = ((PyObject *)__pyx_v_memview);
16980 __Pyx_INCREF(__pyx_t_3);
16981 __pyx_v_obj = ((
struct __pyx_memoryviewslice_obj *)__pyx_t_3);
16991 __pyx_r = (&__pyx_v_obj->from_slice);
17011 __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice);
17020 __pyx_r = __pyx_v_mslice;
17034 __Pyx_XDECREF(__pyx_t_3);
17035 __Pyx_AddTraceback(
"View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
17038 __Pyx_XDECREF((PyObject *)__pyx_v_obj);
17039 __Pyx_RefNannyFinishContext();
17051 static void __pyx_memoryview_slice_copy(
struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) {
17053 Py_ssize_t *__pyx_v_shape;
17054 Py_ssize_t *__pyx_v_strides;
17055 Py_ssize_t *__pyx_v_suboffsets;
17056 __Pyx_RefNannyDeclarations
17057 Py_ssize_t *__pyx_t_1;
17061 Py_ssize_t __pyx_t_5;
17062 __Pyx_RefNannySetupContext(
"slice_copy", 0);
17071 __pyx_t_1 = __pyx_v_memview->view.shape;
17072 __pyx_v_shape = __pyx_t_1;
17081 __pyx_t_1 = __pyx_v_memview->view.strides;
17082 __pyx_v_strides = __pyx_t_1;
17091 __pyx_t_1 = __pyx_v_memview->view.suboffsets;
17092 __pyx_v_suboffsets = __pyx_t_1;
17101 __pyx_v_dst->memview = ((
struct __pyx_memoryview_obj *)__pyx_v_memview);
17110 __pyx_v_dst->data = ((
char *)__pyx_v_memview->view.buf);
17119 __pyx_t_2 = __pyx_v_memview->view.ndim;
17120 __pyx_t_3 = __pyx_t_2;
17121 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
17122 __pyx_v_dim = __pyx_t_4;
17131 (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]);
17140 (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]);
17149 if ((__pyx_v_suboffsets != 0)) {
17150 __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]);
17154 (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5;
17166 __Pyx_RefNannyFinishContext();
17177 static PyObject *__pyx_memoryview_copy_object(
struct __pyx_memoryview_obj *__pyx_v_memview) {
17178 __Pyx_memviewslice __pyx_v_memviewslice;
17179 PyObject *__pyx_r = NULL;
17180 __Pyx_RefNannyDeclarations
17181 PyObject *__pyx_t_1 = NULL;
17182 int __pyx_lineno = 0;
17183 const char *__pyx_filename = NULL;
17184 int __pyx_clineno = 0;
17185 __Pyx_RefNannySetupContext(
"memoryview_copy", 0);
17194 __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice));
17203 __Pyx_XDECREF(__pyx_r);
17204 __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice));
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1084, __pyx_L1_error)
17205 __Pyx_GOTREF(__pyx_t_1);
17206 __pyx_r = __pyx_t_1;
17220 __Pyx_XDECREF(__pyx_t_1);
17221 __Pyx_AddTraceback(
"View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
17224 __Pyx_XGIVEREF(__pyx_r);
17225 __Pyx_RefNannyFinishContext();
17237 static PyObject *__pyx_memoryview_copy_object_from_slice(
struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) {
17238 PyObject *(*__pyx_v_to_object_func)(
char *);
17239 int (*__pyx_v_to_dtype_func)(
char *, PyObject *);
17240 PyObject *__pyx_r = NULL;
17241 __Pyx_RefNannyDeclarations
17244 PyObject *(*__pyx_t_3)(
char *);
17245 int (*__pyx_t_4)(
char *, PyObject *);
17246 PyObject *__pyx_t_5 = NULL;
17247 int __pyx_lineno = 0;
17248 const char *__pyx_filename = NULL;
17249 int __pyx_clineno = 0;
17250 __Pyx_RefNannySetupContext(
"memoryview_copy_from_slice", 0);
17259 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
17260 __pyx_t_2 = (__pyx_t_1 != 0);
17270 __pyx_t_3 = ((
struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
17271 __pyx_v_to_object_func = __pyx_t_3;
17280 __pyx_t_4 = ((
struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
17281 __pyx_v_to_dtype_func = __pyx_t_4;
17301 __pyx_v_to_object_func = NULL;
17310 __pyx_v_to_dtype_func = NULL;
17321 __Pyx_XDECREF(__pyx_r);
17330 __pyx_t_5 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1101, __pyx_L1_error)
17331 __Pyx_GOTREF(__pyx_t_5);
17332 __pyx_r = __pyx_t_5;
17346 __Pyx_XDECREF(__pyx_t_5);
17347 __Pyx_AddTraceback(
"View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
17350 __Pyx_XGIVEREF(__pyx_r);
17351 __Pyx_RefNannyFinishContext();
17363 static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
17364 Py_ssize_t __pyx_r;
17374 __pyx_t_1 = ((__pyx_v_arg < 0) != 0);
17384 __pyx_r = (-__pyx_v_arg);
17404 __pyx_r = __pyx_v_arg;
17429 static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice,
int __pyx_v_ndim) {
17431 Py_ssize_t __pyx_v_c_stride;
17432 Py_ssize_t __pyx_v_f_stride;
17446 __pyx_v_c_stride = 0;
17455 __pyx_v_f_stride = 0;
17464 for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
17465 __pyx_v_i = __pyx_t_1;
17474 __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
17484 __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
17493 goto __pyx_L4_break;
17513 __pyx_t_1 = __pyx_v_ndim;
17514 __pyx_t_3 = __pyx_t_1;
17515 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
17516 __pyx_v_i = __pyx_t_4;
17525 __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
17535 __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
17544 goto __pyx_L7_break;
17564 __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0);
17619 static void _copy_strided_to_strided(
char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides,
char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape,
int __pyx_v_ndim,
size_t __pyx_v_itemsize) {
17620 CYTHON_UNUSED Py_ssize_t __pyx_v_i;
17621 CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent;
17622 Py_ssize_t __pyx_v_dst_extent;
17623 Py_ssize_t __pyx_v_src_stride;
17624 Py_ssize_t __pyx_v_dst_stride;
17628 Py_ssize_t __pyx_t_4;
17629 Py_ssize_t __pyx_t_5;
17630 Py_ssize_t __pyx_t_6;
17639 __pyx_v_src_extent = (__pyx_v_src_shape[0]);
17648 __pyx_v_dst_extent = (__pyx_v_dst_shape[0]);
17657 __pyx_v_src_stride = (__pyx_v_src_strides[0]);
17666 __pyx_v_dst_stride = (__pyx_v_dst_strides[0]);
17675 __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
17685 __pyx_t_2 = ((__pyx_v_src_stride > 0) != 0);
17688 __pyx_t_1 = __pyx_t_2;
17689 goto __pyx_L5_bool_binop_done;
17691 __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0);
17694 __pyx_t_1 = __pyx_t_2;
17695 goto __pyx_L5_bool_binop_done;
17705 __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize);
17707 __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
17709 __pyx_t_3 = (__pyx_t_2 != 0);
17710 __pyx_t_1 = __pyx_t_3;
17711 __pyx_L5_bool_binop_done:;
17729 (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent)));
17749 __pyx_t_4 = __pyx_v_dst_extent;
17750 __pyx_t_5 = __pyx_t_4;
17751 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
17752 __pyx_v_i = __pyx_t_6;
17761 (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize));
17770 __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
17779 __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
17802 __pyx_t_4 = __pyx_v_dst_extent;
17803 __pyx_t_5 = __pyx_t_4;
17804 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
17805 __pyx_v_i = __pyx_t_6;
17814 _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize);
17823 __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
17832 __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
17856 static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst,
int __pyx_v_ndim,
size_t __pyx_v_itemsize) {
17865 _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize);
17886 static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src,
int __pyx_v_ndim) {
17887 Py_ssize_t __pyx_v_shape;
17888 Py_ssize_t __pyx_v_size;
17889 Py_ssize_t __pyx_r;
17890 Py_ssize_t __pyx_t_1;
17891 Py_ssize_t *__pyx_t_2;
17892 Py_ssize_t *__pyx_t_3;
17893 Py_ssize_t *__pyx_t_4;
17902 __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
17903 __pyx_v_size = __pyx_t_1;
17912 __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim);
17913 for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
17914 __pyx_t_2 = __pyx_t_4;
17915 __pyx_v_shape = (__pyx_t_2[0]);
17924 __pyx_v_size = (__pyx_v_size * __pyx_v_shape);
17934 __pyx_r = __pyx_v_size;
17958 static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride,
int __pyx_v_ndim,
char __pyx_v_order) {
17960 Py_ssize_t __pyx_r;
17973 __pyx_t_1 = ((__pyx_v_order ==
'F') != 0);
17983 __pyx_t_2 = __pyx_v_ndim;
17984 __pyx_t_3 = __pyx_t_2;
17985 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
17986 __pyx_v_idx = __pyx_t_4;
17995 (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
18004 __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
18025 for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) {
18026 __pyx_v_idx = __pyx_t_2;
18035 (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
18044 __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
18056 __pyx_r = __pyx_v_stride;
18080 static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice,
char __pyx_v_order,
int __pyx_v_ndim) {
18082 void *__pyx_v_result;
18083 size_t __pyx_v_itemsize;
18084 size_t __pyx_v_size;
18086 Py_ssize_t __pyx_t_1;
18089 struct __pyx_memoryview_obj *__pyx_t_4;
18092 int __pyx_lineno = 0;
18093 const char *__pyx_filename = NULL;
18094 int __pyx_clineno = 0;
18103 __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
18104 __pyx_v_itemsize = __pyx_t_1;
18113 __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim);
18122 __pyx_v_result = malloc(__pyx_v_size);
18131 __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0);
18141 __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL);
if (unlikely(__pyx_t_3 == ((
int)-1))) __PYX_ERR(1, 1224, __pyx_L1_error)
18159 __pyx_v_tmpslice->data = ((
char *)__pyx_v_result);
18168 __pyx_t_4 = __pyx_v_src->memview;
18169 __pyx_v_tmpslice->memview = __pyx_t_4;
18178 __pyx_t_3 = __pyx_v_ndim;
18179 __pyx_t_5 = __pyx_t_3;
18180 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
18181 __pyx_v_i = __pyx_t_6;
18190 (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]);
18199 (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1
L;
18209 (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order));
18218 __pyx_t_3 = __pyx_v_ndim;
18219 __pyx_t_5 = __pyx_t_3;
18220 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
18221 __pyx_v_i = __pyx_t_6;
18230 __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0);
18240 (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0;
18259 __pyx_t_2 = (__pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim) != 0);
18269 (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size));
18289 copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize);
18300 __pyx_r = __pyx_v_result;
18315 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
18317 __Pyx_AddTraceback(
"View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename);
18319 __Pyx_PyGILState_Release(__pyx_gilstate_save);
18335 static int __pyx_memoryview_err_extents(
int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) {
18337 __Pyx_RefNannyDeclarations
18338 PyObject *__pyx_t_1 = NULL;
18339 PyObject *__pyx_t_2 = NULL;
18340 PyObject *__pyx_t_3 = NULL;
18341 PyObject *__pyx_t_4 = NULL;
18342 int __pyx_lineno = 0;
18343 const char *__pyx_filename = NULL;
18344 int __pyx_clineno = 0;
18346 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
18348 __Pyx_RefNannySetupContext(
"_err_extents", 0);
18357 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1254, __pyx_L1_error)
18358 __Pyx_GOTREF(__pyx_t_1);
18359 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1254, __pyx_L1_error)
18360 __Pyx_GOTREF(__pyx_t_2);
18361 __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1254, __pyx_L1_error)
18362 __Pyx_GOTREF(__pyx_t_3);
18363 __pyx_t_4 = PyTuple_New(3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1254, __pyx_L1_error)
18364 __Pyx_GOTREF(__pyx_t_4);
18365 __Pyx_GIVEREF(__pyx_t_1);
18366 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
18367 __Pyx_GIVEREF(__pyx_t_2);
18368 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
18369 __Pyx_GIVEREF(__pyx_t_3);
18370 PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
18382 __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_t_4);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1253, __pyx_L1_error)
18383 __Pyx_GOTREF(__pyx_t_3);
18384 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18385 __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1253, __pyx_L1_error)
18386 __Pyx_GOTREF(__pyx_t_4);
18387 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18388 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
18389 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18390 __PYX_ERR(1, 1253, __pyx_L1_error)
18402 __Pyx_XDECREF(__pyx_t_1);
18403 __Pyx_XDECREF(__pyx_t_2);
18404 __Pyx_XDECREF(__pyx_t_3);
18405 __Pyx_XDECREF(__pyx_t_4);
18406 __Pyx_AddTraceback(
"View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename);
18408 __Pyx_RefNannyFinishContext();
18410 __Pyx_PyGILState_Release(__pyx_gilstate_save);
18423 static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error,
char *__pyx_v_msg,
int __pyx_v_dim) {
18425 __Pyx_RefNannyDeclarations
18426 PyObject *__pyx_t_1 = NULL;
18427 PyObject *__pyx_t_2 = NULL;
18428 PyObject *__pyx_t_3 = NULL;
18429 PyObject *__pyx_t_4 = NULL;
18430 int __pyx_lineno = 0;
18431 const char *__pyx_filename = NULL;
18432 int __pyx_clineno = 0;
18434 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
18436 __Pyx_RefNannySetupContext(
"_err_dim", 0);
18437 __Pyx_INCREF(__pyx_v_error);
18446 __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1258, __pyx_L1_error)
18447 __Pyx_GOTREF(__pyx_t_2);
18448 __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1258, __pyx_L1_error)
18449 __Pyx_GOTREF(__pyx_t_3);
18450 __pyx_t_4 = PyUnicode_Format(__pyx_t_2, __pyx_t_3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1258, __pyx_L1_error)
18451 __Pyx_GOTREF(__pyx_t_4);
18452 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18453 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18454 __Pyx_INCREF(__pyx_v_error);
18455 __pyx_t_3 = __pyx_v_error; __pyx_t_2 = NULL;
18456 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
18457 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
18458 if (likely(__pyx_t_2)) {
18459 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_3);
18460 __Pyx_INCREF(__pyx_t_2);
18461 __Pyx_INCREF(
function);
18462 __Pyx_DECREF_SET(__pyx_t_3,
function);
18465 __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
18466 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
18467 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18468 if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1258, __pyx_L1_error)
18469 __Pyx_GOTREF(__pyx_t_1);
18470 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18471 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
18472 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18473 __PYX_ERR(1, 1258, __pyx_L1_error)
18485 __Pyx_XDECREF(__pyx_t_1);
18486 __Pyx_XDECREF(__pyx_t_2);
18487 __Pyx_XDECREF(__pyx_t_3);
18488 __Pyx_XDECREF(__pyx_t_4);
18489 __Pyx_AddTraceback(
"View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename);
18491 __Pyx_XDECREF(__pyx_v_error);
18492 __Pyx_RefNannyFinishContext();
18494 __Pyx_PyGILState_Release(__pyx_gilstate_save);
18507 static int __pyx_memoryview_err(PyObject *__pyx_v_error,
char *__pyx_v_msg) {
18509 __Pyx_RefNannyDeclarations
18511 PyObject *__pyx_t_2 = NULL;
18512 PyObject *__pyx_t_3 = NULL;
18513 PyObject *__pyx_t_4 = NULL;
18514 PyObject *__pyx_t_5 = NULL;
18515 int __pyx_lineno = 0;
18516 const char *__pyx_filename = NULL;
18517 int __pyx_clineno = 0;
18519 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
18521 __Pyx_RefNannySetupContext(
"_err", 0);
18522 __Pyx_INCREF(__pyx_v_error);
18531 __pyx_t_1 = ((__pyx_v_msg != NULL) != 0);
18532 if (unlikely(__pyx_t_1)) {
18541 __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1263, __pyx_L1_error)
18542 __Pyx_GOTREF(__pyx_t_3);
18543 __Pyx_INCREF(__pyx_v_error);
18544 __pyx_t_4 = __pyx_v_error; __pyx_t_5 = NULL;
18545 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
18546 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
18547 if (likely(__pyx_t_5)) {
18548 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_4);
18549 __Pyx_INCREF(__pyx_t_5);
18550 __Pyx_INCREF(
function);
18551 __Pyx_DECREF_SET(__pyx_t_4,
function);
18554 __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
18555 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
18556 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18557 if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1263, __pyx_L1_error)
18558 __Pyx_GOTREF(__pyx_t_2);
18559 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18560 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
18561 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18562 __PYX_ERR(1, 1263, __pyx_L1_error)
18581 __Pyx_Raise(__pyx_v_error, 0, 0, 0);
18582 __PYX_ERR(1, 1265, __pyx_L1_error)
18595 __Pyx_XDECREF(__pyx_t_2);
18596 __Pyx_XDECREF(__pyx_t_3);
18597 __Pyx_XDECREF(__pyx_t_4);
18598 __Pyx_XDECREF(__pyx_t_5);
18599 __Pyx_AddTraceback(
"View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename);
18601 __Pyx_XDECREF(__pyx_v_error);
18602 __Pyx_RefNannyFinishContext();
18604 __Pyx_PyGILState_Release(__pyx_gilstate_save);
18617 static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst,
int __pyx_v_src_ndim,
int __pyx_v_dst_ndim,
int __pyx_v_dtype_is_object) {
18618 void *__pyx_v_tmpdata;
18619 size_t __pyx_v_itemsize;
18621 char __pyx_v_order;
18622 int __pyx_v_broadcasting;
18623 int __pyx_v_direct_copy;
18624 __Pyx_memviewslice __pyx_v_tmp;
18627 Py_ssize_t __pyx_t_1;
18635 int __pyx_lineno = 0;
18636 const char *__pyx_filename = NULL;
18637 int __pyx_clineno = 0;
18646 __pyx_v_tmpdata = NULL;
18655 __pyx_t_1 = __pyx_v_src.memview->view.itemsize;
18656 __pyx_v_itemsize = __pyx_t_1;
18665 __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim);
18674 __pyx_v_broadcasting = 0;
18683 __pyx_v_direct_copy = 0;
18692 __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0);
18702 __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim);
18721 __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0);
18731 __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim);
18750 __pyx_t_3 = __pyx_v_dst_ndim;
18751 __pyx_t_4 = __pyx_v_src_ndim;
18752 if (((__pyx_t_3 > __pyx_t_4) != 0)) {
18753 __pyx_t_5 = __pyx_t_3;
18755 __pyx_t_5 = __pyx_t_4;
18757 __pyx_v_ndim = __pyx_t_5;
18766 __pyx_t_5 = __pyx_v_ndim;
18767 __pyx_t_3 = __pyx_t_5;
18768 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
18769 __pyx_v_i = __pyx_t_4;
18778 __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0);
18788 __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0);
18798 __pyx_v_broadcasting = 1;
18807 (__pyx_v_src.strides[__pyx_v_i]) = 0;
18827 __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i]));
if (unlikely(__pyx_t_6 == ((
int)-1))) __PYX_ERR(1, 1297, __pyx_L1_error)
18847 __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0);
18857 __pyx_t_6 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((
char *)
"Dimension %d is not direct"), __pyx_v_i);
if (unlikely(__pyx_t_6 == ((
int)-1))) __PYX_ERR(1, 1300, __pyx_L1_error)
18876 __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0);
18886 __pyx_t_2 = ((!(__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0)) != 0);
18896 __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim);
18914 __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim);
if (unlikely(__pyx_t_7 == ((
void *)NULL))) __PYX_ERR(1, 1307, __pyx_L1_error)
18915 __pyx_v_tmpdata = __pyx_t_7;
18924 __pyx_v_src = __pyx_v_tmp;
18942 __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0);
18952 __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src,
'C', __pyx_v_ndim) != 0);
18962 __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst,
'C', __pyx_v_ndim);
18981 __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src,
'F', __pyx_v_ndim) != 0);
18991 __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst,
'F', __pyx_v_ndim);
19010 __pyx_t_2 = (__pyx_v_direct_copy != 0);
19020 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
19029 (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim)));
19038 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
19047 free(__pyx_v_tmpdata);
19084 __pyx_t_2 = (__pyx_v_order ==
'F');
19086 __pyx_t_2 = (
'F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
19088 __pyx_t_8 = (__pyx_t_2 != 0);
19098 __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src));
if (unlikely(__pyx_t_5 == ((
int)0))) __PYX_ERR(1, 1329, __pyx_L1_error)
19107 __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst));
if (unlikely(__pyx_t_5 == ((
int)0))) __PYX_ERR(1, 1330, __pyx_L1_error)
19125 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
19134 copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);
19143 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
19152 free(__pyx_v_tmpdata);
19176 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
19178 __Pyx_AddTraceback(
"View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename);
19180 __Pyx_PyGILState_Release(__pyx_gilstate_save);
19196 static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice,
int __pyx_v_ndim,
int __pyx_v_ndim_other) {
19198 int __pyx_v_offset;
19210 __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim);
19219 for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
19220 __pyx_v_i = __pyx_t_1;
19229 (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]);
19238 (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]);
19247 (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]);
19257 __pyx_t_1 = __pyx_v_offset;
19258 __pyx_t_2 = __pyx_t_1;
19259 for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
19260 __pyx_v_i = __pyx_t_3;
19269 (__pyx_v_mslice->shape[__pyx_v_i]) = 1;
19278 (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]);
19287 (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1
L;
19309 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst,
int __pyx_v_dtype_is_object,
int __pyx_v_ndim,
int __pyx_v_inc) {
19319 __pyx_t_1 = (__pyx_v_dtype_is_object != 0);
19329 __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc);
19359 static void __pyx_memoryview_refcount_objects_in_slice_with_gil(
char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides,
int __pyx_v_ndim,
int __pyx_v_inc) {
19360 __Pyx_RefNannyDeclarations
19362 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
19364 __Pyx_RefNannySetupContext(
"refcount_objects_in_slice_with_gil", 0);
19373 __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc);
19384 __Pyx_RefNannyFinishContext();
19386 __Pyx_PyGILState_Release(__pyx_gilstate_save);
19398 static void __pyx_memoryview_refcount_objects_in_slice(
char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides,
int __pyx_v_ndim,
int __pyx_v_inc) {
19399 CYTHON_UNUSED Py_ssize_t __pyx_v_i;
19400 __Pyx_RefNannyDeclarations
19401 Py_ssize_t __pyx_t_1;
19402 Py_ssize_t __pyx_t_2;
19403 Py_ssize_t __pyx_t_3;
19405 __Pyx_RefNannySetupContext(
"refcount_objects_in_slice", 0);
19414 __pyx_t_1 = (__pyx_v_shape[0]);
19415 __pyx_t_2 = __pyx_t_1;
19416 for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
19417 __pyx_v_i = __pyx_t_3;
19426 __pyx_t_4 = ((__pyx_v_ndim == 1) != 0);
19436 __pyx_t_4 = (__pyx_v_inc != 0);
19446 Py_INCREF((((PyObject **)__pyx_v_data)[0]));
19466 Py_DECREF((((PyObject **)__pyx_v_data)[0]));
19496 __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc);
19507 __pyx_v_data = (__pyx_v_data + (__pyx_v_strides[0]));
19519 __Pyx_RefNannyFinishContext();
19530 static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst,
int __pyx_v_ndim,
size_t __pyx_v_itemsize,
void *__pyx_v_item,
int __pyx_v_dtype_is_object) {
19539 __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
19548 __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item);
19557 __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
19578 static void __pyx_memoryview__slice_assign_scalar(
char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides,
int __pyx_v_ndim,
size_t __pyx_v_itemsize,
void *__pyx_v_item) {
19579 CYTHON_UNUSED Py_ssize_t __pyx_v_i;
19580 Py_ssize_t __pyx_v_stride;
19581 Py_ssize_t __pyx_v_extent;
19583 Py_ssize_t __pyx_t_2;
19584 Py_ssize_t __pyx_t_3;
19585 Py_ssize_t __pyx_t_4;
19594 __pyx_v_stride = (__pyx_v_strides[0]);
19603 __pyx_v_extent = (__pyx_v_shape[0]);
19612 __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
19622 __pyx_t_2 = __pyx_v_extent;
19623 __pyx_t_3 = __pyx_t_2;
19624 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
19625 __pyx_v_i = __pyx_t_4;
19634 (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize));
19643 __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
19664 __pyx_t_2 = __pyx_v_extent;
19665 __pyx_t_3 = __pyx_t_2;
19666 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
19667 __pyx_v_i = __pyx_t_4;
19676 __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item);
19685 __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
19708 static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
19709 static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {
"__pyx_unpickle_Enum", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, METH_VARARGS|METH_KEYWORDS, 0};
19710 static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
19711 PyObject *__pyx_v___pyx_type = 0;
19712 long __pyx_v___pyx_checksum;
19713 PyObject *__pyx_v___pyx_state = 0;
19714 int __pyx_lineno = 0;
19715 const char *__pyx_filename = NULL;
19716 int __pyx_clineno = 0;
19717 PyObject *__pyx_r = 0;
19718 __Pyx_RefNannyDeclarations
19719 __Pyx_RefNannySetupContext(
"__pyx_unpickle_Enum (wrapper)", 0);
19721 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
19722 PyObject* values[3] = {0,0,0};
19723 if (unlikely(__pyx_kwds)) {
19724 Py_ssize_t kw_args;
19725 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
19726 switch (pos_args) {
19727 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
19728 CYTHON_FALLTHROUGH;
19729 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
19730 CYTHON_FALLTHROUGH;
19731 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19732 CYTHON_FALLTHROUGH;
19734 default:
goto __pyx_L5_argtuple_error;
19736 kw_args = PyDict_Size(__pyx_kwds);
19737 switch (pos_args) {
19739 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
19740 else goto __pyx_L5_argtuple_error;
19741 CYTHON_FALLTHROUGH;
19743 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
19745 __Pyx_RaiseArgtupleInvalid(
"__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
19747 CYTHON_FALLTHROUGH;
19749 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
19751 __Pyx_RaiseArgtupleInvalid(
"__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
19754 if (unlikely(kw_args > 0)) {
19755 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__pyx_unpickle_Enum") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
19757 }
else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
19758 goto __pyx_L5_argtuple_error;
19760 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19761 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
19762 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
19764 __pyx_v___pyx_type = values[0];
19765 __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]);
if (unlikely((__pyx_v___pyx_checksum == (
long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
19766 __pyx_v___pyx_state = values[2];
19768 goto __pyx_L4_argument_unpacking_done;
19769 __pyx_L5_argtuple_error:;
19770 __Pyx_RaiseArgtupleInvalid(
"__pyx_unpickle_Enum", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
19772 __Pyx_AddTraceback(
"View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
19773 __Pyx_RefNannyFinishContext();
19775 __pyx_L4_argument_unpacking_done:;
19776 __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
19779 __Pyx_RefNannyFinishContext();
19783 static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type,
long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
19784 PyObject *__pyx_v___pyx_PickleError = 0;
19785 PyObject *__pyx_v___pyx_result = 0;
19786 PyObject *__pyx_r = NULL;
19787 __Pyx_RefNannyDeclarations
19789 PyObject *__pyx_t_2 = NULL;
19790 PyObject *__pyx_t_3 = NULL;
19791 PyObject *__pyx_t_4 = NULL;
19792 PyObject *__pyx_t_5 = NULL;
19794 int __pyx_lineno = 0;
19795 const char *__pyx_filename = NULL;
19796 int __pyx_clineno = 0;
19797 __Pyx_RefNannySetupContext(
"__pyx_unpickle_Enum", 0);
19806 __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xb068931) != 0);
19816 __pyx_t_2 = PyList_New(1);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
19817 __Pyx_GOTREF(__pyx_t_2);
19818 __Pyx_INCREF(__pyx_n_s_PickleError);
19819 __Pyx_GIVEREF(__pyx_n_s_PickleError);
19820 PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
19821 __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
19822 __Pyx_GOTREF(__pyx_t_3);
19823 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19824 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
19825 __Pyx_GOTREF(__pyx_t_2);
19826 __Pyx_INCREF(__pyx_t_2);
19827 __pyx_v___pyx_PickleError = __pyx_t_2;
19828 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19829 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19838 __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
19839 __Pyx_GOTREF(__pyx_t_2);
19840 __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_t_2);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
19841 __Pyx_GOTREF(__pyx_t_4);
19842 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19843 __Pyx_INCREF(__pyx_v___pyx_PickleError);
19844 __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
19845 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
19846 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
19847 if (likely(__pyx_t_5)) {
19848 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_2);
19849 __Pyx_INCREF(__pyx_t_5);
19850 __Pyx_INCREF(
function);
19851 __Pyx_DECREF_SET(__pyx_t_2,
function);
19854 __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
19855 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
19856 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
19857 if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
19858 __Pyx_GOTREF(__pyx_t_3);
19859 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19860 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
19861 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19862 __PYX_ERR(1, 6, __pyx_L1_error)
19880 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
19881 __Pyx_GOTREF(__pyx_t_2);
19883 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
19884 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
19885 if (likely(__pyx_t_4)) {
19886 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_2);
19887 __Pyx_INCREF(__pyx_t_4);
19888 __Pyx_INCREF(
function);
19889 __Pyx_DECREF_SET(__pyx_t_2,
function);
19892 __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
19893 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
19894 if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
19895 __Pyx_GOTREF(__pyx_t_3);
19896 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19897 __pyx_v___pyx_result = __pyx_t_3;
19907 __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
19908 __pyx_t_6 = (__pyx_t_1 != 0);
19918 if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError,
"Expected %.16s, got %.200s",
"tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
19919 __pyx_t_3 = __pyx_unpickle_Enum__set_state(((
struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state));
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
19920 __Pyx_GOTREF(__pyx_t_3);
19921 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19939 __Pyx_XDECREF(__pyx_r);
19940 __Pyx_INCREF(__pyx_v___pyx_result);
19941 __pyx_r = __pyx_v___pyx_result;
19952 __Pyx_XDECREF(__pyx_t_2);
19953 __Pyx_XDECREF(__pyx_t_3);
19954 __Pyx_XDECREF(__pyx_t_4);
19955 __Pyx_XDECREF(__pyx_t_5);
19956 __Pyx_AddTraceback(
"View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
19959 __Pyx_XDECREF(__pyx_v___pyx_PickleError);
19960 __Pyx_XDECREF(__pyx_v___pyx_result);
19961 __Pyx_XGIVEREF(__pyx_r);
19962 __Pyx_RefNannyFinishContext();
19974 static PyObject *__pyx_unpickle_Enum__set_state(
struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
19975 PyObject *__pyx_r = NULL;
19976 __Pyx_RefNannyDeclarations
19977 PyObject *__pyx_t_1 = NULL;
19979 Py_ssize_t __pyx_t_3;
19982 PyObject *__pyx_t_6 = NULL;
19983 PyObject *__pyx_t_7 = NULL;
19984 PyObject *__pyx_t_8 = NULL;
19985 int __pyx_lineno = 0;
19986 const char *__pyx_filename = NULL;
19987 int __pyx_clineno = 0;
19988 __Pyx_RefNannySetupContext(
"__pyx_unpickle_Enum__set_state", 0);
19997 if (unlikely(__pyx_v___pyx_state == Py_None)) {
19998 PyErr_SetString(PyExc_TypeError,
"'NoneType' object is not subscriptable");
19999 __PYX_ERR(1, 12, __pyx_L1_error)
20001 __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0,
long, 1, __Pyx_PyInt_From_long, 0, 0, 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
20002 __Pyx_GOTREF(__pyx_t_1);
20003 __Pyx_GIVEREF(__pyx_t_1);
20004 __Pyx_GOTREF(__pyx_v___pyx_result->name);
20005 __Pyx_DECREF(__pyx_v___pyx_result->name);
20006 __pyx_v___pyx_result->name = __pyx_t_1;
20015 if (unlikely(__pyx_v___pyx_state == Py_None)) {
20016 PyErr_SetString(PyExc_TypeError,
"object of type 'NoneType' has no len()");
20017 __PYX_ERR(1, 13, __pyx_L1_error)
20019 __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state);
if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
20020 __pyx_t_4 = ((__pyx_t_3 > 1) != 0);
20023 __pyx_t_2 = __pyx_t_4;
20024 goto __pyx_L4_bool_binop_done;
20026 __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict);
if (unlikely(__pyx_t_4 == ((
int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
20027 __pyx_t_5 = (__pyx_t_4 != 0);
20028 __pyx_t_2 = __pyx_t_5;
20029 __pyx_L4_bool_binop_done:;
20037 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
20038 __Pyx_GOTREF(__pyx_t_6);
20039 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update);
if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
20040 __Pyx_GOTREF(__pyx_t_7);
20041 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
20042 if (unlikely(__pyx_v___pyx_state == Py_None)) {
20043 PyErr_SetString(PyExc_TypeError,
"'NoneType' object is not subscriptable");
20044 __PYX_ERR(1, 14, __pyx_L1_error)
20046 __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1,
long, 1, __Pyx_PyInt_From_long, 0, 0, 0);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
20047 __Pyx_GOTREF(__pyx_t_6);
20049 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
20050 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
20051 if (likely(__pyx_t_8)) {
20052 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_7);
20053 __Pyx_INCREF(__pyx_t_8);
20054 __Pyx_INCREF(
function);
20055 __Pyx_DECREF_SET(__pyx_t_7,
function);
20058 __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
20059 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
20060 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
20061 if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
20062 __Pyx_GOTREF(__pyx_t_1);
20063 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
20064 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20083 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
20086 __Pyx_XDECREF(__pyx_t_1);
20087 __Pyx_XDECREF(__pyx_t_6);
20088 __Pyx_XDECREF(__pyx_t_7);
20089 __Pyx_XDECREF(__pyx_t_8);
20090 __Pyx_AddTraceback(
"View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
20093 __Pyx_XGIVEREF(__pyx_r);
20094 __Pyx_RefNannyFinishContext();
20098 static PyObject *__pyx_tp_new_15superluWrappers_cSparseMatrix(PyTypeObject *t, PyObject *a, PyObject *k) {
20100 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
20101 o = (*t->tp_alloc)(t, 0);
20103 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
20105 if (unlikely(!o))
return 0;
20106 if (unlikely(__pyx_pw_15superluWrappers_13cSparseMatrix_1__cinit__(o, a, k) < 0))
goto bad;
20109 Py_DECREF(o); o = 0;
20113 static void __pyx_tp_dealloc_15superluWrappers_cSparseMatrix(PyObject *o) {
20114 #if CYTHON_USE_TP_FINALIZE
20115 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
20116 if (PyObject_CallFinalizerFromDealloc(o))
return;
20119 (*Py_TYPE(o)->tp_free)(o);
20122 static PyMethodDef __pyx_methods_15superluWrappers_cSparseMatrix[] = {
20123 {
"__reduce_cython__", (PyCFunction)__pyx_pw_15superluWrappers_13cSparseMatrix_3__reduce_cython__, METH_NOARGS, 0},
20124 {
"__setstate_cython__", (PyCFunction)__pyx_pw_15superluWrappers_13cSparseMatrix_5__setstate_cython__, METH_O, 0},
20128 static PyTypeObject __pyx_type_15superluWrappers_cSparseMatrix = {
20129 PyVarObject_HEAD_INIT(0, 0)
20130 "superluWrappers.cSparseMatrix",
20131 sizeof(
struct __pyx_obj_15superluWrappers_cSparseMatrix),
20133 __pyx_tp_dealloc_15superluWrappers_cSparseMatrix,
20134 #
if PY_VERSION_HEX < 0x030800b4
20137 #
if PY_VERSION_HEX >= 0x030800b4
20142 #
if PY_MAJOR_VERSION < 3
20145 #
if PY_MAJOR_VERSION >= 3
20158 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
20166 __pyx_methods_15superluWrappers_cSparseMatrix,
20176 __pyx_tp_new_15superluWrappers_cSparseMatrix,
20186 #
if PY_VERSION_HEX >= 0x030400a1
20189 #
if PY_VERSION_HEX >= 0x030800b1
20192 #
if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
20196 static struct __pyx_vtabstruct_15superluWrappers_SparseFactor __pyx_vtable_15superluWrappers_SparseFactor;
20198 static PyObject *__pyx_tp_new_15superluWrappers_SparseFactor(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
20199 struct __pyx_obj_15superluWrappers_SparseFactor *p;
20201 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
20202 o = (*t->tp_alloc)(t, 0);
20204 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
20206 if (unlikely(!o))
return 0;
20207 p = ((
struct __pyx_obj_15superluWrappers_SparseFactor *)o);
20208 p->__pyx_vtab = __pyx_vtabptr_15superluWrappers_SparseFactor;
20212 static void __pyx_tp_dealloc_15superluWrappers_SparseFactor(PyObject *o) {
20213 #if CYTHON_USE_TP_FINALIZE
20214 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
20215 if (PyObject_CallFinalizerFromDealloc(o))
return;
20218 (*Py_TYPE(o)->tp_free)(o);
20221 static PyObject *__pyx_getprop_15superluWrappers_12SparseFactor_dim(PyObject *o, CYTHON_UNUSED
void *x) {
20222 return __pyx_pw_15superluWrappers_12SparseFactor_3dim_1__get__(o);
20225 static int __pyx_setprop_15superluWrappers_12SparseFactor_dim(PyObject *o, PyObject *
v, CYTHON_UNUSED
void *x) {
20227 return __pyx_pw_15superluWrappers_12SparseFactor_3dim_3__set__(o,
v);
20230 PyErr_SetString(PyExc_NotImplementedError,
"__del__");
20235 static PyMethodDef __pyx_methods_15superluWrappers_SparseFactor[] = {
20236 {
"__reduce_cython__", (PyCFunction)__pyx_pw_15superluWrappers_12SparseFactor_3__reduce_cython__, METH_NOARGS, 0},
20237 {
"__setstate_cython__", (PyCFunction)__pyx_pw_15superluWrappers_12SparseFactor_5__setstate_cython__, METH_O, 0},
20241 static struct PyGetSetDef __pyx_getsets_15superluWrappers_SparseFactor[] = {
20242 {(
char *)
"dim", __pyx_getprop_15superluWrappers_12SparseFactor_dim, __pyx_setprop_15superluWrappers_12SparseFactor_dim, (
char *)0, 0},
20246 static PyTypeObject __pyx_type_15superluWrappers_SparseFactor = {
20247 PyVarObject_HEAD_INIT(0, 0)
20248 "superluWrappers.SparseFactor",
20249 sizeof(
struct __pyx_obj_15superluWrappers_SparseFactor),
20251 __pyx_tp_dealloc_15superluWrappers_SparseFactor,
20252 #
if PY_VERSION_HEX < 0x030800b4
20255 #
if PY_VERSION_HEX >= 0x030800b4
20260 #
if PY_MAJOR_VERSION < 3
20263 #
if PY_MAJOR_VERSION >= 3
20276 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
20284 __pyx_methods_15superluWrappers_SparseFactor,
20286 __pyx_getsets_15superluWrappers_SparseFactor,
20292 __pyx_pw_15superluWrappers_12SparseFactor_1__init__,
20294 __pyx_tp_new_15superluWrappers_SparseFactor,
20304 #
if PY_VERSION_HEX >= 0x030400a1
20307 #
if PY_VERSION_HEX >= 0x030800b1
20310 #
if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
20314 static struct __pyx_vtabstruct_array __pyx_vtable_array;
20316 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
20317 struct __pyx_array_obj *p;
20319 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
20320 o = (*t->tp_alloc)(t, 0);
20322 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
20324 if (unlikely(!o))
return 0;
20325 p = ((
struct __pyx_array_obj *)o);
20326 p->__pyx_vtab = __pyx_vtabptr_array;
20327 p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
20328 p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
20329 if (unlikely(__pyx_array___cinit__(o, a, k) < 0))
goto bad;
20332 Py_DECREF(o); o = 0;
20336 static void __pyx_tp_dealloc_array(PyObject *o) {
20337 struct __pyx_array_obj *p = (
struct __pyx_array_obj *)o;
20338 #if CYTHON_USE_TP_FINALIZE
20339 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
20340 if (PyObject_CallFinalizerFromDealloc(o))
return;
20344 PyObject *etype, *eval, *etb;
20345 PyErr_Fetch(&etype, &eval, &etb);
20346 __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
20347 __pyx_array___dealloc__(o);
20348 __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
20349 PyErr_Restore(etype, eval, etb);
20352 Py_CLEAR(p->_format);
20353 (*Py_TYPE(o)->tp_free)(o);
20355 static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
20357 PyObject *x = PyInt_FromSsize_t(i);
if(!x)
return 0;
20358 r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
20363 static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *
v) {
20365 return __pyx_array___setitem__(o, i,
v);
20368 PyErr_Format(PyExc_NotImplementedError,
20369 "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
20374 static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *
n) {
20375 PyObject *
v = __Pyx_PyObject_GenericGetAttr(o,
n);
20376 if (!
v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
20378 v = __pyx_array___getattr__(o,
n);
20383 static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED
void *x) {
20384 return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o);
20387 static PyMethodDef __pyx_methods_array[] = {
20388 {
"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0},
20389 {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_array_1__reduce_cython__, METH_NOARGS, 0},
20390 {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_array_3__setstate_cython__, METH_O, 0},
20394 static struct PyGetSetDef __pyx_getsets_array[] = {
20395 {(
char *)
"memview", __pyx_getprop___pyx_array_memview, 0, (
char *)0, 0},
20399 static PySequenceMethods __pyx_tp_as_sequence_array = {
20400 __pyx_array___len__,
20403 __pyx_sq_item_array,
20412 static PyMappingMethods __pyx_tp_as_mapping_array = {
20413 __pyx_array___len__,
20414 __pyx_array___getitem__,
20415 __pyx_mp_ass_subscript_array,
20418 static PyBufferProcs __pyx_tp_as_buffer_array = {
20419 #if PY_MAJOR_VERSION < 3
20422 #if PY_MAJOR_VERSION < 3
20425 #if PY_MAJOR_VERSION < 3
20428 #if PY_MAJOR_VERSION < 3
20431 __pyx_array_getbuffer,
20435 static PyTypeObject __pyx_type___pyx_array = {
20436 PyVarObject_HEAD_INIT(0, 0)
20437 "superluWrappers.array",
20438 sizeof(
struct __pyx_array_obj),
20440 __pyx_tp_dealloc_array,
20441 #
if PY_VERSION_HEX < 0x030800b4
20444 #
if PY_VERSION_HEX >= 0x030800b4
20449 #
if PY_MAJOR_VERSION < 3
20452 #
if PY_MAJOR_VERSION >= 3
20457 &__pyx_tp_as_sequence_array,
20458 &__pyx_tp_as_mapping_array,
20462 __pyx_tp_getattro_array,
20464 &__pyx_tp_as_buffer_array,
20465 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
20473 __pyx_methods_array,
20475 __pyx_getsets_array,
20483 __pyx_tp_new_array,
20493 #
if PY_VERSION_HEX >= 0x030400a1
20496 #
if PY_VERSION_HEX >= 0x030800b1
20499 #
if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
20504 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
20505 struct __pyx_MemviewEnum_obj *p;
20507 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
20508 o = (*t->tp_alloc)(t, 0);
20510 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
20512 if (unlikely(!o))
return 0;
20513 p = ((
struct __pyx_MemviewEnum_obj *)o);
20514 p->name = Py_None; Py_INCREF(Py_None);
20518 static void __pyx_tp_dealloc_Enum(PyObject *o) {
20519 struct __pyx_MemviewEnum_obj *p = (
struct __pyx_MemviewEnum_obj *)o;
20520 #if CYTHON_USE_TP_FINALIZE
20521 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
20522 if (PyObject_CallFinalizerFromDealloc(o))
return;
20525 PyObject_GC_UnTrack(o);
20527 (*Py_TYPE(o)->tp_free)(o);
20530 static int __pyx_tp_traverse_Enum(PyObject *o, visitproc
v,
void *a) {
20532 struct __pyx_MemviewEnum_obj *p = (
struct __pyx_MemviewEnum_obj *)o;
20534 e = (*v)(p->name, a);
if (e)
return e;
20539 static int __pyx_tp_clear_Enum(PyObject *o) {
20541 struct __pyx_MemviewEnum_obj *p = (
struct __pyx_MemviewEnum_obj *)o;
20542 tmp = ((PyObject*)p->name);
20543 p->name = Py_None; Py_INCREF(Py_None);
20548 static PyMethodDef __pyx_methods_Enum[] = {
20549 {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, METH_NOARGS, 0},
20550 {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, METH_O, 0},
20554 static PyTypeObject __pyx_type___pyx_MemviewEnum = {
20555 PyVarObject_HEAD_INIT(0, 0)
20556 "superluWrappers.Enum",
20557 sizeof(
struct __pyx_MemviewEnum_obj),
20559 __pyx_tp_dealloc_Enum,
20560 #
if PY_VERSION_HEX < 0x030800b4
20563 #
if PY_VERSION_HEX >= 0x030800b4
20568 #
if PY_MAJOR_VERSION < 3
20571 #
if PY_MAJOR_VERSION >= 3
20574 __pyx_MemviewEnum___repr__,
20584 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
20586 __pyx_tp_traverse_Enum,
20587 __pyx_tp_clear_Enum,
20592 __pyx_methods_Enum,
20600 __pyx_MemviewEnum___init__,
20612 #
if PY_VERSION_HEX >= 0x030400a1
20615 #
if PY_VERSION_HEX >= 0x030800b1
20618 #
if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
20622 static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
20624 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
20625 struct __pyx_memoryview_obj *p;
20627 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
20628 o = (*t->tp_alloc)(t, 0);
20630 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
20632 if (unlikely(!o))
return 0;
20633 p = ((
struct __pyx_memoryview_obj *)o);
20634 p->__pyx_vtab = __pyx_vtabptr_memoryview;
20635 p->obj = Py_None; Py_INCREF(Py_None);
20636 p->_size = Py_None; Py_INCREF(Py_None);
20637 p->_array_interface = Py_None; Py_INCREF(Py_None);
20638 p->view.obj = NULL;
20639 if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0))
goto bad;
20642 Py_DECREF(o); o = 0;
20646 static void __pyx_tp_dealloc_memoryview(PyObject *o) {
20647 struct __pyx_memoryview_obj *p = (
struct __pyx_memoryview_obj *)o;
20648 #if CYTHON_USE_TP_FINALIZE
20649 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
20650 if (PyObject_CallFinalizerFromDealloc(o))
return;
20653 PyObject_GC_UnTrack(o);
20655 PyObject *etype, *eval, *etb;
20656 PyErr_Fetch(&etype, &eval, &etb);
20657 __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
20658 __pyx_memoryview___dealloc__(o);
20659 __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
20660 PyErr_Restore(etype, eval, etb);
20663 Py_CLEAR(p->_size);
20664 Py_CLEAR(p->_array_interface);
20665 (*Py_TYPE(o)->tp_free)(o);
20668 static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc
v,
void *a) {
20670 struct __pyx_memoryview_obj *p = (
struct __pyx_memoryview_obj *)o;
20672 e = (*v)(p->obj, a);
if (e)
return e;
20675 e = (*v)(p->_size, a);
if (e)
return e;
20677 if (p->_array_interface) {
20678 e = (*v)(p->_array_interface, a);
if (e)
return e;
20681 e = (*v)(p->view.obj, a);
if (e)
return e;
20686 static int __pyx_tp_clear_memoryview(PyObject *o) {
20688 struct __pyx_memoryview_obj *p = (
struct __pyx_memoryview_obj *)o;
20689 tmp = ((PyObject*)p->obj);
20690 p->obj = Py_None; Py_INCREF(Py_None);
20692 tmp = ((PyObject*)p->_size);
20693 p->_size = Py_None; Py_INCREF(Py_None);
20695 tmp = ((PyObject*)p->_array_interface);
20696 p->_array_interface = Py_None; Py_INCREF(Py_None);
20698 Py_CLEAR(p->view.obj);
20701 static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
20703 PyObject *x = PyInt_FromSsize_t(i);
if(!x)
return 0;
20704 r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
20709 static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *
v) {
20711 return __pyx_memoryview___setitem__(o, i,
v);
20714 PyErr_Format(PyExc_NotImplementedError,
20715 "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
20720 static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED
void *x) {
20721 return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o);
20724 static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED
void *x) {
20725 return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o);
20728 static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED
void *x) {
20729 return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o);
20732 static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED
void *x) {
20733 return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o);
20736 static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED
void *x) {
20737 return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o);
20740 static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED
void *x) {
20741 return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o);
20744 static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED
void *x) {
20745 return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o);
20748 static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED
void *x) {
20749 return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o);
20752 static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED
void *x) {
20753 return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o);
20756 static PyMethodDef __pyx_methods_memoryview[] = {
20757 {
"is_c_contig", (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, 0},
20758 {
"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0},
20759 {
"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0},
20760 {
"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0},
20761 {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_1__reduce_cython__, METH_NOARGS, 0},
20762 {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_3__setstate_cython__, METH_O, 0},
20766 static struct PyGetSetDef __pyx_getsets_memoryview[] = {
20767 {(
char *)
"T", __pyx_getprop___pyx_memoryview_T, 0, (
char *)0, 0},
20768 {(
char *)
"base", __pyx_getprop___pyx_memoryview_base, 0, (
char *)0, 0},
20769 {(
char *)
"shape", __pyx_getprop___pyx_memoryview_shape, 0, (
char *)0, 0},
20770 {(
char *)
"strides", __pyx_getprop___pyx_memoryview_strides, 0, (
char *)0, 0},
20771 {(
char *)
"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, (
char *)0, 0},
20772 {(
char *)
"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, (
char *)0, 0},
20773 {(
char *)
"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, (
char *)0, 0},
20774 {(
char *)
"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, (
char *)0, 0},
20775 {(
char *)
"size", __pyx_getprop___pyx_memoryview_size, 0, (
char *)0, 0},
20779 static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
20780 __pyx_memoryview___len__,
20783 __pyx_sq_item_memoryview,
20792 static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
20793 __pyx_memoryview___len__,
20794 __pyx_memoryview___getitem__,
20795 __pyx_mp_ass_subscript_memoryview,
20798 static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
20799 #if PY_MAJOR_VERSION < 3
20802 #if PY_MAJOR_VERSION < 3
20805 #if PY_MAJOR_VERSION < 3
20808 #if PY_MAJOR_VERSION < 3
20811 __pyx_memoryview_getbuffer,
20815 static PyTypeObject __pyx_type___pyx_memoryview = {
20816 PyVarObject_HEAD_INIT(0, 0)
20817 "superluWrappers.memoryview",
20818 sizeof(
struct __pyx_memoryview_obj),
20820 __pyx_tp_dealloc_memoryview,
20821 #
if PY_VERSION_HEX < 0x030800b4
20824 #
if PY_VERSION_HEX >= 0x030800b4
20829 #
if PY_MAJOR_VERSION < 3
20832 #
if PY_MAJOR_VERSION >= 3
20835 __pyx_memoryview___repr__,
20837 &__pyx_tp_as_sequence_memoryview,
20838 &__pyx_tp_as_mapping_memoryview,
20841 __pyx_memoryview___str__,
20844 &__pyx_tp_as_buffer_memoryview,
20845 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
20847 __pyx_tp_traverse_memoryview,
20848 __pyx_tp_clear_memoryview,
20853 __pyx_methods_memoryview,
20855 __pyx_getsets_memoryview,
20863 __pyx_tp_new_memoryview,
20873 #
if PY_VERSION_HEX >= 0x030400a1
20876 #
if PY_VERSION_HEX >= 0x030800b1
20879 #
if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
20883 static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;
20885 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) {
20886 struct __pyx_memoryviewslice_obj *p;
20887 PyObject *o = __pyx_tp_new_memoryview(t, a, k);
20888 if (unlikely(!o))
return 0;
20889 p = ((
struct __pyx_memoryviewslice_obj *)o);
20890 p->__pyx_base.__pyx_vtab = (
struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice;
20891 p->from_object = Py_None; Py_INCREF(Py_None);
20892 p->from_slice.memview = NULL;
20896 static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
20897 struct __pyx_memoryviewslice_obj *p = (
struct __pyx_memoryviewslice_obj *)o;
20898 #if CYTHON_USE_TP_FINALIZE
20899 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
20900 if (PyObject_CallFinalizerFromDealloc(o))
return;
20903 PyObject_GC_UnTrack(o);
20905 PyObject *etype, *eval, *etb;
20906 PyErr_Fetch(&etype, &eval, &etb);
20907 __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
20908 __pyx_memoryviewslice___dealloc__(o);
20909 __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
20910 PyErr_Restore(etype, eval, etb);
20912 Py_CLEAR(p->from_object);
20913 PyObject_GC_Track(o);
20914 __pyx_tp_dealloc_memoryview(o);
20917 static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc
v,
void *a) {
20919 struct __pyx_memoryviewslice_obj *p = (
struct __pyx_memoryviewslice_obj *)o;
20920 e = __pyx_tp_traverse_memoryview(o,
v, a);
if (e)
return e;
20921 if (p->from_object) {
20922 e = (*v)(p->from_object, a);
if (e)
return e;
20927 static int __pyx_tp_clear__memoryviewslice(PyObject *o) {
20929 struct __pyx_memoryviewslice_obj *p = (
struct __pyx_memoryviewslice_obj *)o;
20930 __pyx_tp_clear_memoryview(o);
20931 tmp = ((PyObject*)p->from_object);
20932 p->from_object = Py_None; Py_INCREF(Py_None);
20934 __PYX_XDEC_MEMVIEW(&p->from_slice, 1);
20938 static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED
void *x) {
20939 return __pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(o);
20942 static PyMethodDef __pyx_methods__memoryviewslice[] = {
20943 {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, METH_NOARGS, 0},
20944 {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, METH_O, 0},
20948 static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
20949 {(
char *)
"base", __pyx_getprop___pyx_memoryviewslice_base, 0, (
char *)0, 0},
20953 static PyTypeObject __pyx_type___pyx_memoryviewslice = {
20954 PyVarObject_HEAD_INIT(0, 0)
20955 "superluWrappers._memoryviewslice",
20956 sizeof(
struct __pyx_memoryviewslice_obj),
20958 __pyx_tp_dealloc__memoryviewslice,
20959 #
if PY_VERSION_HEX < 0x030800b4
20962 #
if PY_VERSION_HEX >= 0x030800b4
20967 #
if PY_MAJOR_VERSION < 3
20970 #
if PY_MAJOR_VERSION >= 3
20973 #
if CYTHON_COMPILING_IN_PYPY
20974 __pyx_memoryview___repr__,
20983 #
if CYTHON_COMPILING_IN_PYPY
20984 __pyx_memoryview___str__,
20991 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
20992 "Internal class for passing memoryview slices to Python",
20993 __pyx_tp_traverse__memoryviewslice,
20994 __pyx_tp_clear__memoryviewslice,
20999 __pyx_methods__memoryviewslice,
21001 __pyx_getsets__memoryviewslice,
21009 __pyx_tp_new__memoryviewslice,
21019 #
if PY_VERSION_HEX >= 0x030400a1
21022 #
if PY_VERSION_HEX >= 0x030800b1
21025 #
if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
21030 static PyMethodDef __pyx_methods[] = {
21034 #if PY_MAJOR_VERSION >= 3
21035 #if CYTHON_PEP489_MULTI_PHASE_INIT
21036 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def);
21037 static int __pyx_pymod_exec_superluWrappers(PyObject* module);
21038 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
21039 {Py_mod_create, (
void*)__pyx_pymod_create},
21040 {Py_mod_exec, (
void*)__pyx_pymod_exec_superluWrappers},
21045 static struct PyModuleDef __pyx_moduledef = {
21046 PyModuleDef_HEAD_INIT,
21049 #if CYTHON_PEP489_MULTI_PHASE_INIT
21055 #if CYTHON_PEP489_MULTI_PHASE_INIT
21056 __pyx_moduledef_slots,
21065 #ifndef CYTHON_SMALL_CODE
21066 #if defined(__clang__)
21067 #define CYTHON_SMALL_CODE
21068 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
21069 #define CYTHON_SMALL_CODE __attribute__((cold))
21071 #define CYTHON_SMALL_CODE
21075 static __Pyx_StringTabEntry __pyx_string_tab[] = {
21076 {&__pyx_n_s_ASCII, __pyx_k_ASCII,
sizeof(__pyx_k_ASCII), 0, 0, 1, 1},
21077 {&__pyx_kp_s_Buffer_view_does_not_expose_stri, __pyx_k_Buffer_view_does_not_expose_stri,
sizeof(__pyx_k_Buffer_view_does_not_expose_stri), 0, 0, 1, 0},
21078 {&__pyx_kp_s_Can_only_create_a_buffer_that_is, __pyx_k_Can_only_create_a_buffer_that_is,
sizeof(__pyx_k_Can_only_create_a_buffer_that_is), 0, 0, 1, 0},
21079 {&__pyx_kp_s_Cannot_assign_to_read_only_memor, __pyx_k_Cannot_assign_to_read_only_memor,
sizeof(__pyx_k_Cannot_assign_to_read_only_memor), 0, 0, 1, 0},
21080 {&__pyx_kp_s_Cannot_create_writable_memory_vi, __pyx_k_Cannot_create_writable_memory_vi,
sizeof(__pyx_k_Cannot_create_writable_memory_vi), 0, 0, 1, 0},
21081 {&__pyx_kp_s_Cannot_index_with_type_s, __pyx_k_Cannot_index_with_type_s,
sizeof(__pyx_k_Cannot_index_with_type_s), 0, 0, 1, 0},
21082 {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis,
sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1},
21083 {&__pyx_kp_s_Empty_shape_tuple_for_cython_arr, __pyx_k_Empty_shape_tuple_for_cython_arr,
sizeof(__pyx_k_Empty_shape_tuple_for_cython_arr), 0, 0, 1, 0},
21084 {&__pyx_n_s_ImportError, __pyx_k_ImportError,
sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
21085 {&__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_k_Incompatible_checksums_s_vs_0xb0,
sizeof(__pyx_k_Incompatible_checksums_s_vs_0xb0), 0, 0, 1, 0},
21086 {&__pyx_n_s_IndexError, __pyx_k_IndexError,
sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
21087 {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte,
sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0},
21088 {&__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_k_Invalid_mode_expected_c_or_fortr,
sizeof(__pyx_k_Invalid_mode_expected_c_or_fortr), 0, 0, 1, 0},
21089 {&__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_k_Invalid_shape_in_axis_d_d,
sizeof(__pyx_k_Invalid_shape_in_axis_d_d), 0, 0, 1, 0},
21090 {&__pyx_n_s_MemoryError, __pyx_k_MemoryError,
sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
21091 {&__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_k_MemoryView_of_r_at_0x_x,
sizeof(__pyx_k_MemoryView_of_r_at_0x_x), 0, 0, 1, 0},
21092 {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object,
sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0},
21093 {&__pyx_n_b_O, __pyx_k_O,
sizeof(__pyx_k_O), 0, 0, 0, 1},
21094 {&__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_k_Out_of_bounds_on_buffer_access_a,
sizeof(__pyx_k_Out_of_bounds_on_buffer_access_a), 0, 0, 1, 0},
21095 {&__pyx_n_s_PickleError, __pyx_k_PickleError,
sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
21096 {&__pyx_n_s_SparseFactor, __pyx_k_SparseFactor,
sizeof(__pyx_k_SparseFactor), 0, 0, 1, 1},
21097 {&__pyx_n_s_SparseMatrix, __pyx_k_SparseMatrix,
sizeof(__pyx_k_SparseMatrix), 0, 0, 1, 1},
21098 {&__pyx_n_s_SparseMatrix___init, __pyx_k_SparseMatrix___init,
sizeof(__pyx_k_SparseMatrix___init), 0, 0, 1, 1},
21099 {&__pyx_n_s_SparseMatrix_fwrite, __pyx_k_SparseMatrix_fwrite,
sizeof(__pyx_k_SparseMatrix_fwrite), 0, 0, 1, 1},
21100 {&__pyx_n_s_SparseMatrix_getCSRrepresentatio, __pyx_k_SparseMatrix_getCSRrepresentatio,
sizeof(__pyx_k_SparseMatrix_getCSRrepresentatio), 0, 0, 1, 1},
21101 {&__pyx_n_s_SparseMatrix_getSubMatCSRreprese, __pyx_k_SparseMatrix_getSubMatCSRreprese,
sizeof(__pyx_k_SparseMatrix_getSubMatCSRreprese), 0, 0, 1, 1},
21102 {&__pyx_n_s_SparseMatrix_matvec, __pyx_k_SparseMatrix_matvec,
sizeof(__pyx_k_SparseMatrix_matvec), 0, 0, 1, 1},
21103 {&__pyx_n_s_TypeError, __pyx_k_TypeError,
sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
21104 {&__pyx_kp_s_Unable_to_convert_item_to_object, __pyx_k_Unable_to_convert_item_to_object,
sizeof(__pyx_k_Unable_to_convert_item_to_object), 0, 0, 1, 0},
21105 {&__pyx_n_s_ValueError, __pyx_k_ValueError,
sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
21106 {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView,
sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1},
21107 {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer,
sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1},
21108 {&__pyx_n_s_base, __pyx_k_base,
sizeof(__pyx_k_base), 0, 0, 1, 1},
21109 {&__pyx_n_s_c, __pyx_k_c,
sizeof(__pyx_k_c), 0, 0, 1, 1},
21110 {&__pyx_n_u_c, __pyx_k_c,
sizeof(__pyx_k_c), 0, 1, 0, 1},
21111 {&__pyx_n_s_cSparseMatrix, __pyx_k_cSparseMatrix,
sizeof(__pyx_k_cSparseMatrix), 0, 0, 1, 1},
21112 {&__pyx_n_s_cSparseMatrix_2, __pyx_k_cSparseMatrix_2,
sizeof(__pyx_k_cSparseMatrix_2), 0, 0, 1, 1},
21113 {&__pyx_n_s_class, __pyx_k_class,
sizeof(__pyx_k_class), 0, 0, 1, 1},
21114 {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback,
sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
21115 {&__pyx_n_s_colind, __pyx_k_colind,
sizeof(__pyx_k_colind), 0, 0, 1, 1},
21116 {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct,
sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0},
21117 {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect,
sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0},
21118 {&__pyx_kp_s_d_d_13_8e, __pyx_k_d_d_13_8e,
sizeof(__pyx_k_d_d_13_8e), 0, 0, 1, 0},
21119 {&__pyx_n_s_dict, __pyx_k_dict,
sizeof(__pyx_k_dict), 0, 0, 1, 1},
21120 {&__pyx_n_s_dim, __pyx_k_dim,
sizeof(__pyx_k_dim), 0, 0, 1, 1},
21121 {&__pyx_n_s_doc, __pyx_k_doc,
sizeof(__pyx_k_doc), 0, 0, 1, 1},
21122 {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object,
sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1},
21123 {&__pyx_n_s_encode, __pyx_k_encode,
sizeof(__pyx_k_encode), 0, 0, 1, 1},
21124 {&__pyx_n_s_enter, __pyx_k_enter,
sizeof(__pyx_k_enter), 0, 0, 1, 1},
21125 {&__pyx_n_s_enumerate, __pyx_k_enumerate,
sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
21126 {&__pyx_n_s_error, __pyx_k_error,
sizeof(__pyx_k_error), 0, 0, 1, 1},
21127 {&__pyx_n_s_exit, __pyx_k_exit,
sizeof(__pyx_k_exit), 0, 0, 1, 1},
21128 {&__pyx_n_s_filename, __pyx_k_filename,
sizeof(__pyx_k_filename), 0, 0, 1, 1},
21129 {&__pyx_n_s_flags, __pyx_k_flags,
sizeof(__pyx_k_flags), 0, 0, 1, 1},
21130 {&__pyx_n_s_format, __pyx_k_format,
sizeof(__pyx_k_format), 0, 0, 1, 1},
21131 {&__pyx_n_s_fortran, __pyx_k_fortran,
sizeof(__pyx_k_fortran), 0, 0, 1, 1},
21132 {&__pyx_n_u_fortran, __pyx_k_fortran,
sizeof(__pyx_k_fortran), 0, 1, 0, 1},
21133 {&__pyx_n_s_fwrite, __pyx_k_fwrite,
sizeof(__pyx_k_fwrite), 0, 0, 1, 1},
21134 {&__pyx_n_s_getCSRrepresentation, __pyx_k_getCSRrepresentation,
sizeof(__pyx_k_getCSRrepresentation), 0, 0, 1, 1},
21135 {&__pyx_n_s_getSubMatCSRrepresentation, __pyx_k_getSubMatCSRrepresentation,
sizeof(__pyx_k_getSubMatCSRrepresentation), 0, 0, 1, 1},
21136 {&__pyx_n_s_getstate, __pyx_k_getstate,
sizeof(__pyx_k_getstate), 0, 0, 1, 1},
21137 {&__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_k_got_differing_extents_in_dimensi,
sizeof(__pyx_k_got_differing_extents_in_dimensi), 0, 0, 1, 0},
21138 {&__pyx_n_s_i, __pyx_k_i,
sizeof(__pyx_k_i), 0, 0, 1, 1},
21139 {&__pyx_kp_s_i_i_i, __pyx_k_i_i_i,
sizeof(__pyx_k_i_i_i), 0, 0, 1, 0},
21140 {&__pyx_n_s_id, __pyx_k_id,
sizeof(__pyx_k_id), 0, 0, 1, 1},
21141 {&__pyx_n_s_import, __pyx_k_import,
sizeof(__pyx_k_import), 0, 0, 1, 1},
21142 {&__pyx_n_s_init, __pyx_k_init,
sizeof(__pyx_k_init), 0, 0, 1, 1},
21143 {&__pyx_n_s_itemsize, __pyx_k_itemsize,
sizeof(__pyx_k_itemsize), 0, 0, 1, 1},
21144 {&__pyx_kp_s_itemsize_0_for_cython_array, __pyx_k_itemsize_0_for_cython_array,
sizeof(__pyx_k_itemsize_0_for_cython_array), 0, 0, 1, 0},
21145 {&__pyx_n_s_k, __pyx_k_k,
sizeof(__pyx_k_k), 0, 0, 1, 1},
21146 {&__pyx_n_s_main, __pyx_k_main,
sizeof(__pyx_k_main), 0, 0, 1, 1},
21147 {&__pyx_n_s_matvec, __pyx_k_matvec,
sizeof(__pyx_k_matvec), 0, 0, 1, 1},
21148 {&__pyx_n_s_memview, __pyx_k_memview,
sizeof(__pyx_k_memview), 0, 0, 1, 1},
21149 {&__pyx_n_s_metaclass, __pyx_k_metaclass,
sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
21150 {&__pyx_n_s_mode, __pyx_k_mode,
sizeof(__pyx_k_mode), 0, 0, 1, 1},
21151 {&__pyx_n_s_module, __pyx_k_module,
sizeof(__pyx_k_module), 0, 0, 1, 1},
21152 {&__pyx_n_s_name, __pyx_k_name,
sizeof(__pyx_k_name), 0, 0, 1, 1},
21153 {&__pyx_n_s_name_2, __pyx_k_name_2,
sizeof(__pyx_k_name_2), 0, 0, 1, 1},
21154 {&__pyx_n_s_nc, __pyx_k_nc,
sizeof(__pyx_k_nc), 0, 0, 1, 1},
21155 {&__pyx_n_s_ndim, __pyx_k_ndim,
sizeof(__pyx_k_ndim), 0, 0, 1, 1},
21156 {&__pyx_n_s_new, __pyx_k_new,
sizeof(__pyx_k_new), 0, 0, 1, 1},
21157 {&__pyx_n_s_nnz, __pyx_k_nnz,
sizeof(__pyx_k_nnz), 0, 0, 1, 1},
21158 {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non,
sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0},
21159 {&__pyx_n_s_np, __pyx_k_np,
sizeof(__pyx_k_np), 0, 0, 1, 1},
21160 {&__pyx_n_s_nr, __pyx_k_nr,
sizeof(__pyx_k_nr), 0, 0, 1, 1},
21161 {&__pyx_n_s_numpy, __pyx_k_numpy,
sizeof(__pyx_k_numpy), 0, 0, 1, 1},
21162 {&__pyx_kp_s_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to,
sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 0, 1, 0},
21163 {&__pyx_kp_s_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor,
sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 0, 1, 0},
21164 {&__pyx_n_s_nzval, __pyx_k_nzval,
sizeof(__pyx_k_nzval), 0, 0, 1, 1},
21165 {&__pyx_n_s_nzvals, __pyx_k_nzvals,
sizeof(__pyx_k_nzvals), 0, 0, 1, 1},
21166 {&__pyx_n_s_obj, __pyx_k_obj,
sizeof(__pyx_k_obj), 0, 0, 1, 1},
21167 {&__pyx_n_s_object, __pyx_k_object,
sizeof(__pyx_k_object), 0, 0, 1, 1},
21168 {&__pyx_n_s_open, __pyx_k_open,
sizeof(__pyx_k_open), 0, 0, 1, 1},
21169 {&__pyx_n_s_output_file, __pyx_k_output_file,
sizeof(__pyx_k_output_file), 0, 0, 1, 1},
21170 {&__pyx_n_s_pack, __pyx_k_pack,
sizeof(__pyx_k_pack), 0, 0, 1, 1},
21171 {&__pyx_n_s_pickle, __pyx_k_pickle,
sizeof(__pyx_k_pickle), 0, 0, 1, 1},
21172 {&__pyx_n_s_prepare, __pyx_k_prepare,
sizeof(__pyx_k_prepare), 0, 0, 1, 1},
21173 {&__pyx_kp_s_proteus_superluWrappers_pyx, __pyx_k_proteus_superluWrappers_pyx,
sizeof(__pyx_k_proteus_superluWrappers_pyx), 0, 0, 1, 0},
21174 {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError,
sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
21175 {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum,
sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
21176 {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer,
sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1},
21177 {&__pyx_n_s_pyx_result, __pyx_k_pyx_result,
sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
21178 {&__pyx_n_s_pyx_state, __pyx_k_pyx_state,
sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
21179 {&__pyx_n_s_pyx_type, __pyx_k_pyx_type,
sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
21180 {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum,
sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1},
21181 {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable,
sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
21182 {&__pyx_n_s_qualname, __pyx_k_qualname,
sizeof(__pyx_k_qualname), 0, 0, 1, 1},
21183 {&__pyx_n_s_range, __pyx_k_range,
sizeof(__pyx_k_range), 0, 0, 1, 1},
21184 {&__pyx_n_s_range_end, __pyx_k_range_end,
sizeof(__pyx_k_range_end), 0, 0, 1, 1},
21185 {&__pyx_n_s_range_start, __pyx_k_range_start,
sizeof(__pyx_k_range_start), 0, 0, 1, 1},
21186 {&__pyx_n_s_reduce, __pyx_k_reduce,
sizeof(__pyx_k_reduce), 0, 0, 1, 1},
21187 {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython,
sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
21188 {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex,
sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
21189 {&__pyx_n_s_rowptr, __pyx_k_rowptr,
sizeof(__pyx_k_rowptr), 0, 0, 1, 1},
21190 {&__pyx_n_s_rows, __pyx_k_rows,
sizeof(__pyx_k_rows), 0, 0, 1, 1},
21191 {&__pyx_n_s_self, __pyx_k_self,
sizeof(__pyx_k_self), 0, 0, 1, 1},
21192 {&__pyx_kp_s_self_A_self_AC_self_L_self_U_sel, __pyx_k_self_A_self_AC_self_L_self_U_sel,
sizeof(__pyx_k_self_A_self_AC_self_L_self_U_sel), 0, 0, 1, 0},
21193 {&__pyx_n_s_setstate, __pyx_k_setstate,
sizeof(__pyx_k_setstate), 0, 0, 1, 1},
21194 {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython,
sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
21195 {&__pyx_n_s_shape, __pyx_k_shape,
sizeof(__pyx_k_shape), 0, 0, 1, 1},
21196 {&__pyx_n_s_size, __pyx_k_size,
sizeof(__pyx_k_size), 0, 0, 1, 1},
21197 {&__pyx_n_s_sparseFactor, __pyx_k_sparseFactor,
sizeof(__pyx_k_sparseFactor), 0, 0, 1, 1},
21198 {&__pyx_n_s_sparseFactorPrepare, __pyx_k_sparseFactorPrepare,
sizeof(__pyx_k_sparseFactorPrepare), 0, 0, 1, 1},
21199 {&__pyx_n_s_sparseFactorSolve, __pyx_k_sparseFactorSolve,
sizeof(__pyx_k_sparseFactorSolve), 0, 0, 1, 1},
21200 {&__pyx_n_s_sparse_matrix, __pyx_k_sparse_matrix,
sizeof(__pyx_k_sparse_matrix), 0, 0, 1, 1},
21201 {&__pyx_n_s_start, __pyx_k_start,
sizeof(__pyx_k_start), 0, 0, 1, 1},
21202 {&__pyx_n_s_step, __pyx_k_step,
sizeof(__pyx_k_step), 0, 0, 1, 1},
21203 {&__pyx_n_s_stop, __pyx_k_stop,
sizeof(__pyx_k_stop), 0, 0, 1, 1},
21204 {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct,
sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0},
21205 {&__pyx_kp_s_strided_and_direct_or_indirect, __pyx_k_strided_and_direct_or_indirect,
sizeof(__pyx_k_strided_and_direct_or_indirect), 0, 0, 1, 0},
21206 {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect,
sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0},
21207 {&__pyx_kp_s_stringsource, __pyx_k_stringsource,
sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
21208 {&__pyx_n_s_struct, __pyx_k_struct,
sizeof(__pyx_k_struct), 0, 0, 1, 1},
21209 {&__pyx_n_s_superluWrappers, __pyx_k_superluWrappers,
sizeof(__pyx_k_superluWrappers), 0, 0, 1, 1},
21210 {&__pyx_n_s_test, __pyx_k_test,
sizeof(__pyx_k_test), 0, 0, 1, 1},
21211 {&__pyx_kp_s_unable_to_allocate_array_data, __pyx_k_unable_to_allocate_array_data,
sizeof(__pyx_k_unable_to_allocate_array_data), 0, 0, 1, 0},
21212 {&__pyx_kp_s_unable_to_allocate_shape_and_str, __pyx_k_unable_to_allocate_shape_and_str,
sizeof(__pyx_k_unable_to_allocate_shape_and_str), 0, 0, 1, 0},
21213 {&__pyx_n_s_unpack, __pyx_k_unpack,
sizeof(__pyx_k_unpack), 0, 0, 1, 1},
21214 {&__pyx_n_s_update, __pyx_k_update,
sizeof(__pyx_k_update), 0, 0, 1, 1},
21215 {&__pyx_n_s_w, __pyx_k_w,
sizeof(__pyx_k_w), 0, 0, 1, 1},
21216 {&__pyx_n_s_write, __pyx_k_write,
sizeof(__pyx_k_write), 0, 0, 1, 1},
21217 {&__pyx_n_s_x, __pyx_k_x,
sizeof(__pyx_k_x), 0, 0, 1, 1},
21218 {&__pyx_n_s_y, __pyx_k_y,
sizeof(__pyx_k_y), 0, 0, 1, 1},
21219 {0, 0, 0, 0, 0, 0, 0}
21221 static CYTHON_SMALL_CODE
int __Pyx_InitCachedBuiltins(
void) {
21222 __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s_object);
if (!__pyx_builtin_object) __PYX_ERR(0, 13, __pyx_L1_error)
21223 __pyx_builtin_open = __Pyx_GetBuiltinName(__pyx_n_s_open);
if (!__pyx_builtin_open) __PYX_ERR(0, 56, __pyx_L1_error)
21224 __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range);
if (!__pyx_builtin_range) __PYX_ERR(0, 58, __pyx_L1_error)
21225 __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError);
if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error)
21226 __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError);
if (!__pyx_builtin_ImportError) __PYX_ERR(2, 945, __pyx_L1_error)
21227 __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError);
if (!__pyx_builtin_ValueError) __PYX_ERR(1, 133, __pyx_L1_error)
21228 __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError);
if (!__pyx_builtin_MemoryError) __PYX_ERR(1, 148, __pyx_L1_error)
21229 __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate);
if (!__pyx_builtin_enumerate) __PYX_ERR(1, 151, __pyx_L1_error)
21230 __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis);
if (!__pyx_builtin_Ellipsis) __PYX_ERR(1, 404, __pyx_L1_error)
21231 __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id);
if (!__pyx_builtin_id) __PYX_ERR(1, 613, __pyx_L1_error)
21232 __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError);
if (!__pyx_builtin_IndexError) __PYX_ERR(1, 832, __pyx_L1_error)
21238 static CYTHON_SMALL_CODE
int __Pyx_InitCachedConstants(
void) {
21239 __Pyx_RefNannyDeclarations
21240 __Pyx_RefNannySetupContext(
"__Pyx_InitCachedConstants", 0);
21249 __pyx_tuple_ = PyTuple_Pack(3, Py_None, Py_None, Py_None);
if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 56, __pyx_L1_error)
21250 __Pyx_GOTREF(__pyx_tuple_);
21251 __Pyx_GIVEREF(__pyx_tuple_);
21259 __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 2, __pyx_L1_error)
21260 __Pyx_GOTREF(__pyx_tuple__2);
21261 __Pyx_GIVEREF(__pyx_tuple__2);
21268 __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 4, __pyx_L1_error)
21269 __Pyx_GOTREF(__pyx_tuple__3);
21270 __Pyx_GIVEREF(__pyx_tuple__3);
21278 __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_self_A_self_AC_self_L_self_U_sel);
if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 2, __pyx_L1_error)
21279 __Pyx_GOTREF(__pyx_tuple__4);
21280 __Pyx_GIVEREF(__pyx_tuple__4);
21287 __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_self_A_self_AC_self_L_self_U_sel);
if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 4, __pyx_L1_error)
21288 __Pyx_GOTREF(__pyx_tuple__5);
21289 __Pyx_GIVEREF(__pyx_tuple__5);
21298 __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to);
if (unlikely(!__pyx_tuple__6)) __PYX_ERR(2, 945, __pyx_L1_error)
21299 __Pyx_GOTREF(__pyx_tuple__6);
21300 __Pyx_GIVEREF(__pyx_tuple__6);
21309 __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor);
if (unlikely(!__pyx_tuple__7)) __PYX_ERR(2, 951, __pyx_L1_error)
21310 __Pyx_GOTREF(__pyx_tuple__7);
21311 __Pyx_GIVEREF(__pyx_tuple__7);
21320 __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr);
if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 133, __pyx_L1_error)
21321 __Pyx_GOTREF(__pyx_tuple__8);
21322 __Pyx_GIVEREF(__pyx_tuple__8);
21331 __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array);
if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 136, __pyx_L1_error)
21332 __Pyx_GOTREF(__pyx_tuple__9);
21333 __Pyx_GIVEREF(__pyx_tuple__9);
21342 __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str);
if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 148, __pyx_L1_error)
21343 __Pyx_GOTREF(__pyx_tuple__10);
21344 __Pyx_GIVEREF(__pyx_tuple__10);
21353 __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data);
if (unlikely(!__pyx_tuple__11)) __PYX_ERR(1, 176, __pyx_L1_error)
21354 __Pyx_GOTREF(__pyx_tuple__11);
21355 __Pyx_GIVEREF(__pyx_tuple__11);
21364 __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is);
if (unlikely(!__pyx_tuple__12)) __PYX_ERR(1, 192, __pyx_L1_error)
21365 __Pyx_GOTREF(__pyx_tuple__12);
21366 __Pyx_GIVEREF(__pyx_tuple__12);
21374 __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__13)) __PYX_ERR(1, 2, __pyx_L1_error)
21375 __Pyx_GOTREF(__pyx_tuple__13);
21376 __Pyx_GIVEREF(__pyx_tuple__13);
21383 __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__14)) __PYX_ERR(1, 4, __pyx_L1_error)
21384 __Pyx_GOTREF(__pyx_tuple__14);
21385 __Pyx_GIVEREF(__pyx_tuple__14);
21394 __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_Cannot_assign_to_read_only_memor);
if (unlikely(!__pyx_tuple__15)) __PYX_ERR(1, 418, __pyx_L1_error)
21395 __Pyx_GOTREF(__pyx_tuple__15);
21396 __Pyx_GIVEREF(__pyx_tuple__15);
21405 __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object);
if (unlikely(!__pyx_tuple__16)) __PYX_ERR(1, 495, __pyx_L1_error)
21406 __Pyx_GOTREF(__pyx_tuple__16);
21407 __Pyx_GIVEREF(__pyx_tuple__16);
21416 __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_Cannot_create_writable_memory_vi);
if (unlikely(!__pyx_tuple__17)) __PYX_ERR(1, 520, __pyx_L1_error)
21417 __Pyx_GOTREF(__pyx_tuple__17);
21418 __Pyx_GIVEREF(__pyx_tuple__17);
21427 __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri);
if (unlikely(!__pyx_tuple__18)) __PYX_ERR(1, 570, __pyx_L1_error)
21428 __Pyx_GOTREF(__pyx_tuple__18);
21429 __Pyx_GIVEREF(__pyx_tuple__18);
21438 __pyx_tuple__19 = PyTuple_New(1);
if (unlikely(!__pyx_tuple__19)) __PYX_ERR(1, 577, __pyx_L1_error)
21439 __Pyx_GOTREF(__pyx_tuple__19);
21440 __Pyx_INCREF(__pyx_int_neg_1);
21441 __Pyx_GIVEREF(__pyx_int_neg_1);
21442 PyTuple_SET_ITEM(__pyx_tuple__19, 0, __pyx_int_neg_1);
21443 __Pyx_GIVEREF(__pyx_tuple__19);
21451 __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__20)) __PYX_ERR(1, 2, __pyx_L1_error)
21452 __Pyx_GOTREF(__pyx_tuple__20);
21453 __Pyx_GIVEREF(__pyx_tuple__20);
21460 __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__21)) __PYX_ERR(1, 4, __pyx_L1_error)
21461 __Pyx_GOTREF(__pyx_tuple__21);
21462 __Pyx_GIVEREF(__pyx_tuple__21);
21471 __pyx_slice__22 = PySlice_New(Py_None, Py_None, Py_None);
if (unlikely(!__pyx_slice__22)) __PYX_ERR(1, 682, __pyx_L1_error)
21472 __Pyx_GOTREF(__pyx_slice__22);
21473 __Pyx_GIVEREF(__pyx_slice__22);
21482 __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte);
if (unlikely(!__pyx_tuple__23)) __PYX_ERR(1, 703, __pyx_L1_error)
21483 __Pyx_GOTREF(__pyx_tuple__23);
21484 __Pyx_GIVEREF(__pyx_tuple__23);
21492 __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__24)) __PYX_ERR(1, 2, __pyx_L1_error)
21493 __Pyx_GOTREF(__pyx_tuple__24);
21494 __Pyx_GIVEREF(__pyx_tuple__24);
21501 __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__25)) __PYX_ERR(1, 4, __pyx_L1_error)
21502 __Pyx_GOTREF(__pyx_tuple__25);
21503 __Pyx_GIVEREF(__pyx_tuple__25);
21512 __pyx_tuple__26 = PyTuple_Pack(1, __pyx_builtin_object);
if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 13, __pyx_L1_error)
21513 __Pyx_GOTREF(__pyx_tuple__26);
21514 __Pyx_GIVEREF(__pyx_tuple__26);
21523 __pyx_tuple__27 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_nr, __pyx_n_s_nc, __pyx_n_s_nnz, __pyx_n_s_nzvals, __pyx_n_s_colind, __pyx_n_s_rowptr);
if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 15, __pyx_L1_error)
21524 __Pyx_GOTREF(__pyx_tuple__27);
21525 __Pyx_GIVEREF(__pyx_tuple__27);
21526 __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(7, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_superluWrappers_pyx, __pyx_n_s_init, 15, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 15, __pyx_L1_error)
21535 __pyx_tuple__29 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_x, __pyx_n_s_y);
if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 35, __pyx_L1_error)
21536 __Pyx_GOTREF(__pyx_tuple__29);
21537 __Pyx_GIVEREF(__pyx_tuple__29);
21538 __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_superluWrappers_pyx, __pyx_n_s_matvec, 35, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 35, __pyx_L1_error)
21547 __pyx_tuple__31 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_filename, __pyx_n_s_base, __pyx_n_s_output_file, __pyx_n_s_i, __pyx_n_s_k);
if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 46, __pyx_L1_error)
21548 __Pyx_GOTREF(__pyx_tuple__31);
21549 __Pyx_GIVEREF(__pyx_tuple__31);
21550 __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_superluWrappers_pyx, __pyx_n_s_fwrite, 46, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 46, __pyx_L1_error)
21559 __pyx_tuple__33 = PyTuple_Pack(1, __pyx_n_s_self);
if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 62, __pyx_L1_error)
21560 __Pyx_GOTREF(__pyx_tuple__33);
21561 __Pyx_GIVEREF(__pyx_tuple__33);
21562 __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_superluWrappers_pyx, __pyx_n_s_getCSRrepresentation, 62, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 62, __pyx_L1_error)
21571 __pyx_tuple__35 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_range_start, __pyx_n_s_range_end, __pyx_n_s_rows, __pyx_n_s_nnz, __pyx_n_s_rowptr, __pyx_n_s_colind, __pyx_n_s_nzvals);
if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 72, __pyx_L1_error)
21572 __Pyx_GOTREF(__pyx_tuple__35);
21573 __Pyx_GIVEREF(__pyx_tuple__35);
21574 __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(3, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_superluWrappers_pyx, __pyx_n_s_getSubMatCSRrepresentation, 72, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 72, __pyx_L1_error)
21583 __pyx_tuple__37 = PyTuple_Pack(2, __pyx_n_s_sparse_matrix, __pyx_n_s_sparseFactor);
if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 219, __pyx_L1_error)
21584 __Pyx_GOTREF(__pyx_tuple__37);
21585 __Pyx_GIVEREF(__pyx_tuple__37);
21586 __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_superluWrappers_pyx, __pyx_n_s_sparseFactorPrepare, 219, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 219, __pyx_L1_error)
21595 __pyx_tuple__39 = PyTuple_Pack(2, __pyx_n_s_sparseFactor, __pyx_n_s_x);
if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 286, __pyx_L1_error)
21596 __Pyx_GOTREF(__pyx_tuple__39);
21597 __Pyx_GIVEREF(__pyx_tuple__39);
21598 __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_superluWrappers_pyx, __pyx_n_s_sparseFactorSolve, 286, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 286, __pyx_L1_error)
21607 __pyx_tuple__41 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect);
if (unlikely(!__pyx_tuple__41)) __PYX_ERR(1, 286, __pyx_L1_error)
21608 __Pyx_GOTREF(__pyx_tuple__41);
21609 __Pyx_GIVEREF(__pyx_tuple__41);
21618 __pyx_tuple__42 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct);
if (unlikely(!__pyx_tuple__42)) __PYX_ERR(1, 287, __pyx_L1_error)
21619 __Pyx_GOTREF(__pyx_tuple__42);
21620 __Pyx_GIVEREF(__pyx_tuple__42);
21629 __pyx_tuple__43 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect);
if (unlikely(!__pyx_tuple__43)) __PYX_ERR(1, 288, __pyx_L1_error)
21630 __Pyx_GOTREF(__pyx_tuple__43);
21631 __Pyx_GIVEREF(__pyx_tuple__43);
21640 __pyx_tuple__44 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct);
if (unlikely(!__pyx_tuple__44)) __PYX_ERR(1, 291, __pyx_L1_error)
21641 __Pyx_GOTREF(__pyx_tuple__44);
21642 __Pyx_GIVEREF(__pyx_tuple__44);
21651 __pyx_tuple__45 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect);
if (unlikely(!__pyx_tuple__45)) __PYX_ERR(1, 292, __pyx_L1_error)
21652 __Pyx_GOTREF(__pyx_tuple__45);
21653 __Pyx_GIVEREF(__pyx_tuple__45);
21660 __pyx_tuple__46 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result);
if (unlikely(!__pyx_tuple__46)) __PYX_ERR(1, 1, __pyx_L1_error)
21661 __Pyx_GOTREF(__pyx_tuple__46);
21662 __Pyx_GIVEREF(__pyx_tuple__46);
21663 __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(1, 1, __pyx_L1_error)
21664 __Pyx_RefNannyFinishContext();
21667 __Pyx_RefNannyFinishContext();
21671 static CYTHON_SMALL_CODE
int __Pyx_InitGlobals(
void) {
21672 if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
21673 __pyx_int_0 = PyInt_FromLong(0);
if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
21674 __pyx_int_1 = PyInt_FromLong(1);
if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
21675 __pyx_int_184977713 = PyInt_FromLong(184977713
L);
if (unlikely(!__pyx_int_184977713)) __PYX_ERR(0, 1, __pyx_L1_error)
21676 __pyx_int_neg_1 = PyInt_FromLong(-1);
if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
21682 static CYTHON_SMALL_CODE
int __Pyx_modinit_global_init_code(
void);
21683 static CYTHON_SMALL_CODE
int __Pyx_modinit_variable_export_code(
void);
21684 static CYTHON_SMALL_CODE
int __Pyx_modinit_function_export_code(
void);
21685 static CYTHON_SMALL_CODE
int __Pyx_modinit_type_init_code(
void);
21686 static CYTHON_SMALL_CODE
int __Pyx_modinit_type_import_code(
void);
21687 static CYTHON_SMALL_CODE
int __Pyx_modinit_variable_import_code(
void);
21688 static CYTHON_SMALL_CODE
int __Pyx_modinit_function_import_code(
void);
21690 static int __Pyx_modinit_global_init_code(
void) {
21691 __Pyx_RefNannyDeclarations
21692 __Pyx_RefNannySetupContext(
"__Pyx_modinit_global_init_code", 0);
21694 generic = Py_None; Py_INCREF(Py_None);
21695 strided = Py_None; Py_INCREF(Py_None);
21696 indirect = Py_None; Py_INCREF(Py_None);
21697 contiguous = Py_None; Py_INCREF(Py_None);
21698 indirect_contiguous = Py_None; Py_INCREF(Py_None);
21699 __Pyx_RefNannyFinishContext();
21703 static int __Pyx_modinit_variable_export_code(
void) {
21704 __Pyx_RefNannyDeclarations
21705 __Pyx_RefNannySetupContext(
"__Pyx_modinit_variable_export_code", 0);
21707 __Pyx_RefNannyFinishContext();
21711 static int __Pyx_modinit_function_export_code(
void) {
21712 __Pyx_RefNannyDeclarations
21713 __Pyx_RefNannySetupContext(
"__Pyx_modinit_function_export_code", 0);
21715 __Pyx_RefNannyFinishContext();
21719 static int __Pyx_modinit_type_init_code(
void) {
21720 __Pyx_RefNannyDeclarations
21721 int __pyx_lineno = 0;
21722 const char *__pyx_filename = NULL;
21723 int __pyx_clineno = 0;
21724 __Pyx_RefNannySetupContext(
"__Pyx_modinit_type_init_code", 0);
21726 if (PyType_Ready(&__pyx_type_15superluWrappers_cSparseMatrix) < 0) __PYX_ERR(0, 100, __pyx_L1_error)
21727 #if PY_VERSION_HEX < 0x030800B1
21728 __pyx_type_15superluWrappers_cSparseMatrix.tp_print = 0;
21730 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_15superluWrappers_cSparseMatrix.tp_dictoffset && __pyx_type_15superluWrappers_cSparseMatrix.tp_getattro == PyObject_GenericGetAttr)) {
21731 __pyx_type_15superluWrappers_cSparseMatrix.tp_getattro = __Pyx_PyObject_GenericGetAttr;
21733 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_cSparseMatrix_2, (PyObject *)&__pyx_type_15superluWrappers_cSparseMatrix) < 0) __PYX_ERR(0, 100, __pyx_L1_error)
21734 if (__Pyx_setup_reduce((PyObject*)&__pyx_type_15superluWrappers_cSparseMatrix) < 0) __PYX_ERR(0, 100, __pyx_L1_error)
21735 __pyx_ptype_15superluWrappers_cSparseMatrix = &__pyx_type_15superluWrappers_cSparseMatrix;
21736 __pyx_vtabptr_15superluWrappers_SparseFactor = &__pyx_vtable_15superluWrappers_SparseFactor;
21737 __pyx_vtable_15superluWrappers_SparseFactor._set_mat_types = (PyObject *(*)(
struct __pyx_obj_15superluWrappers_SparseFactor *))__pyx_f_15superluWrappers_12SparseFactor__set_mat_types;
21738 if (PyType_Ready(&__pyx_type_15superluWrappers_SparseFactor) < 0) __PYX_ERR(0, 145, __pyx_L1_error)
21739 #if PY_VERSION_HEX < 0x030800B1
21740 __pyx_type_15superluWrappers_SparseFactor.tp_print = 0;
21742 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_15superluWrappers_SparseFactor.tp_dictoffset && __pyx_type_15superluWrappers_SparseFactor.tp_getattro == PyObject_GenericGetAttr)) {
21743 __pyx_type_15superluWrappers_SparseFactor.tp_getattro = __Pyx_PyObject_GenericGetAttr;
21745 #if CYTHON_COMPILING_IN_CPYTHON
21747 PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_15superluWrappers_SparseFactor,
"__init__");
if (unlikely(!wrapper)) __PYX_ERR(0, 145, __pyx_L1_error)
21748 if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
21749 __pyx_wrapperbase_15superluWrappers_12SparseFactor___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
21750 __pyx_wrapperbase_15superluWrappers_12SparseFactor___init__.doc = __pyx_doc_15superluWrappers_12SparseFactor___init__;
21751 ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_15superluWrappers_12SparseFactor___init__;
21755 if (__Pyx_SetVtable(__pyx_type_15superluWrappers_SparseFactor.tp_dict, __pyx_vtabptr_15superluWrappers_SparseFactor) < 0) __PYX_ERR(0, 145, __pyx_L1_error)
21756 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_SparseFactor, (PyObject *)&__pyx_type_15superluWrappers_SparseFactor) < 0) __PYX_ERR(0, 145, __pyx_L1_error)
21757 if (__Pyx_setup_reduce((PyObject*)&__pyx_type_15superluWrappers_SparseFactor) < 0) __PYX_ERR(0, 145, __pyx_L1_error)
21758 __pyx_ptype_15superluWrappers_SparseFactor = &__pyx_type_15superluWrappers_SparseFactor;
21759 __pyx_vtabptr_array = &__pyx_vtable_array;
21760 __pyx_vtable_array.get_memview = (PyObject *(*)(
struct __pyx_array_obj *))__pyx_array_get_memview;
21761 if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(1, 105, __pyx_L1_error)
21762 #if PY_VERSION_HEX < 0x030800B1
21763 __pyx_type___pyx_array.tp_print = 0;
21765 if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(1, 105, __pyx_L1_error)
21766 if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_array) < 0) __PYX_ERR(1, 105, __pyx_L1_error)
21767 __pyx_array_type = &__pyx_type___pyx_array;
21768 if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(1, 279, __pyx_L1_error)
21769 #if PY_VERSION_HEX < 0x030800B1
21770 __pyx_type___pyx_MemviewEnum.tp_print = 0;
21772 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_MemviewEnum.tp_dictoffset && __pyx_type___pyx_MemviewEnum.tp_getattro == PyObject_GenericGetAttr)) {
21773 __pyx_type___pyx_MemviewEnum.tp_getattro = __Pyx_PyObject_GenericGetAttr;
21775 if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(1, 279, __pyx_L1_error)
21776 __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
21777 __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview;
21778 __pyx_vtable_memoryview.get_item_pointer = (
char *(*)(
struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer;
21779 __pyx_vtable_memoryview.is_slice = (PyObject *(*)(
struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice;
21780 __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(
struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment;
21781 __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(
struct __pyx_memoryview_obj *,
struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar;
21782 __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(
struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed;
21783 __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(
struct __pyx_memoryview_obj *,
char *))__pyx_memoryview_convert_item_to_object;
21784 __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(
struct __pyx_memoryview_obj *,
char *, PyObject *))__pyx_memoryview_assign_item_from_object;
21785 if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(1, 330, __pyx_L1_error)
21786 #if PY_VERSION_HEX < 0x030800B1
21787 __pyx_type___pyx_memoryview.tp_print = 0;
21789 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryview.tp_dictoffset && __pyx_type___pyx_memoryview.tp_getattro == PyObject_GenericGetAttr)) {
21790 __pyx_type___pyx_memoryview.tp_getattro = __Pyx_PyObject_GenericGetAttr;
21792 if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(1, 330, __pyx_L1_error)
21793 if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(1, 330, __pyx_L1_error)
21794 __pyx_memoryview_type = &__pyx_type___pyx_memoryview;
21795 __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice;
21796 __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview;
21797 __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(
struct __pyx_memoryview_obj *,
char *))__pyx_memoryviewslice_convert_item_to_object;
21798 __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(
struct __pyx_memoryview_obj *,
char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object;
21799 __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type;
21800 if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(1, 965, __pyx_L1_error)
21801 #if PY_VERSION_HEX < 0x030800B1
21802 __pyx_type___pyx_memoryviewslice.tp_print = 0;
21804 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryviewslice.tp_dictoffset && __pyx_type___pyx_memoryviewslice.tp_getattro == PyObject_GenericGetAttr)) {
21805 __pyx_type___pyx_memoryviewslice.tp_getattro = __Pyx_PyObject_GenericGetAttr;
21807 if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(1, 965, __pyx_L1_error)
21808 if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(1, 965, __pyx_L1_error)
21809 __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice;
21810 __Pyx_RefNannyFinishContext();
21813 __Pyx_RefNannyFinishContext();
21817 static int __Pyx_modinit_type_import_code(
void) {
21818 __Pyx_RefNannyDeclarations
21819 PyObject *__pyx_t_1 = NULL;
21820 int __pyx_lineno = 0;
21821 const char *__pyx_filename = NULL;
21822 int __pyx_clineno = 0;
21823 __Pyx_RefNannySetupContext(
"__Pyx_modinit_type_import_code", 0);
21825 __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME);
if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error)
21826 __Pyx_GOTREF(__pyx_t_1);
21827 __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME,
"type",
21828 #
if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
21829 sizeof(PyTypeObject),
21831 sizeof(PyHeapTypeObject),
21833 __Pyx_ImportType_CheckSize_Warn);
21834 if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error)
21835 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21836 __pyx_t_1 = PyImport_ImportModule(
"numpy");
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 200, __pyx_L1_error)
21837 __Pyx_GOTREF(__pyx_t_1);
21838 __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1,
"numpy",
"dtype",
sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore);
21839 if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(2, 200, __pyx_L1_error)
21840 __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1,
"numpy",
"flatiter",
sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Ignore);
21841 if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(2, 223, __pyx_L1_error)
21842 __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1,
"numpy",
"broadcast",
sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Ignore);
21843 if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(2, 227, __pyx_L1_error)
21844 __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1,
"numpy",
"ndarray",
sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore);
21845 if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(2, 239, __pyx_L1_error)
21846 __pyx_ptype_5numpy_generic = __Pyx_ImportType(__pyx_t_1,
"numpy",
"generic",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
21847 if (!__pyx_ptype_5numpy_generic) __PYX_ERR(2, 771, __pyx_L1_error)
21848 __pyx_ptype_5numpy_number = __Pyx_ImportType(__pyx_t_1,
"numpy",
"number",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
21849 if (!__pyx_ptype_5numpy_number) __PYX_ERR(2, 773, __pyx_L1_error)
21850 __pyx_ptype_5numpy_integer = __Pyx_ImportType(__pyx_t_1,
"numpy",
"integer",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
21851 if (!__pyx_ptype_5numpy_integer) __PYX_ERR(2, 775, __pyx_L1_error)
21852 __pyx_ptype_5numpy_signedinteger = __Pyx_ImportType(__pyx_t_1,
"numpy",
"signedinteger",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
21853 if (!__pyx_ptype_5numpy_signedinteger) __PYX_ERR(2, 777, __pyx_L1_error)
21854 __pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType(__pyx_t_1,
"numpy",
"unsignedinteger",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
21855 if (!__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(2, 779, __pyx_L1_error)
21856 __pyx_ptype_5numpy_inexact = __Pyx_ImportType(__pyx_t_1,
"numpy",
"inexact",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
21857 if (!__pyx_ptype_5numpy_inexact) __PYX_ERR(2, 781, __pyx_L1_error)
21858 __pyx_ptype_5numpy_floating = __Pyx_ImportType(__pyx_t_1,
"numpy",
"floating",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
21859 if (!__pyx_ptype_5numpy_floating) __PYX_ERR(2, 783, __pyx_L1_error)
21860 __pyx_ptype_5numpy_complexfloating = __Pyx_ImportType(__pyx_t_1,
"numpy",
"complexfloating",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
21861 if (!__pyx_ptype_5numpy_complexfloating) __PYX_ERR(2, 785, __pyx_L1_error)
21862 __pyx_ptype_5numpy_flexible = __Pyx_ImportType(__pyx_t_1,
"numpy",
"flexible",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
21863 if (!__pyx_ptype_5numpy_flexible) __PYX_ERR(2, 787, __pyx_L1_error)
21864 __pyx_ptype_5numpy_character = __Pyx_ImportType(__pyx_t_1,
"numpy",
"character",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
21865 if (!__pyx_ptype_5numpy_character) __PYX_ERR(2, 789, __pyx_L1_error)
21866 __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1,
"numpy",
"ufunc",
sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Ignore);
21867 if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(2, 827, __pyx_L1_error)
21868 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21869 __Pyx_RefNannyFinishContext();
21872 __Pyx_XDECREF(__pyx_t_1);
21873 __Pyx_RefNannyFinishContext();
21877 static int __Pyx_modinit_variable_import_code(
void) {
21878 __Pyx_RefNannyDeclarations
21879 __Pyx_RefNannySetupContext(
"__Pyx_modinit_variable_import_code", 0);
21881 __Pyx_RefNannyFinishContext();
21885 static int __Pyx_modinit_function_import_code(
void) {
21886 __Pyx_RefNannyDeclarations
21887 __Pyx_RefNannySetupContext(
"__Pyx_modinit_function_import_code", 0);
21889 __Pyx_RefNannyFinishContext();
21894 #ifndef CYTHON_NO_PYINIT_EXPORT
21895 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
21896 #elif PY_MAJOR_VERSION < 3
21898 #define __Pyx_PyMODINIT_FUNC extern "C" void
21900 #define __Pyx_PyMODINIT_FUNC void
21904 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
21906 #define __Pyx_PyMODINIT_FUNC PyObject *
21911 #if PY_MAJOR_VERSION < 3
21912 __Pyx_PyMODINIT_FUNC initsuperluWrappers(
void) CYTHON_SMALL_CODE;
21913 __Pyx_PyMODINIT_FUNC initsuperluWrappers(
void)
21915 __Pyx_PyMODINIT_FUNC PyInit_superluWrappers(
void) CYTHON_SMALL_CODE;
21916 __Pyx_PyMODINIT_FUNC PyInit_superluWrappers(
void)
21917 #if CYTHON_PEP489_MULTI_PHASE_INIT
21919 return PyModuleDef_Init(&__pyx_moduledef);
21921 static CYTHON_SMALL_CODE
int __Pyx_check_single_interpreter(
void) {
21922 #if PY_VERSION_HEX >= 0x030700A1
21923 static PY_INT64_T main_interpreter_id = -1;
21924 PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
21925 if (main_interpreter_id == -1) {
21926 main_interpreter_id = current_id;
21927 return (unlikely(current_id == -1)) ? -1 : 0;
21928 }
else if (unlikely(main_interpreter_id != current_id))
21930 static PyInterpreterState *main_interpreter = NULL;
21931 PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
21932 if (!main_interpreter) {
21933 main_interpreter = current_interpreter;
21934 }
else if (unlikely(main_interpreter != current_interpreter))
21939 "Interpreter change detected - this module can only be loaded into one interpreter per process.");
21944 static CYTHON_SMALL_CODE
int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict,
const char* from_name,
const char* to_name,
int allow_none) {
21945 PyObject *value = PyObject_GetAttrString(spec, from_name);
21947 if (likely(value)) {
21948 if (allow_none || value != Py_None) {
21949 result = PyDict_SetItemString(moddict, to_name, value);
21952 }
else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
21959 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
21960 PyObject *module = NULL, *moddict, *modname;
21961 if (__Pyx_check_single_interpreter())
21964 return __Pyx_NewRef(__pyx_m);
21965 modname = PyObject_GetAttrString(spec,
"name");
21966 if (unlikely(!modname))
goto bad;
21967 module = PyModule_NewObject(modname);
21968 Py_DECREF(modname);
21969 if (unlikely(!module))
goto bad;
21970 moddict = PyModule_GetDict(module);
21971 if (unlikely(!moddict))
goto bad;
21972 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"loader",
"__loader__", 1) < 0))
goto bad;
21973 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"origin",
"__file__", 1) < 0))
goto bad;
21974 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"parent",
"__package__", 1) < 0))
goto bad;
21975 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"submodule_search_locations",
"__path__", 0) < 0))
goto bad;
21978 Py_XDECREF(module);
21983 static CYTHON_SMALL_CODE
int __pyx_pymod_exec_superluWrappers(PyObject *__pyx_pyinit_module)
21987 PyObject *__pyx_t_1 = NULL;
21988 PyObject *__pyx_t_2 = NULL;
21989 PyObject *__pyx_t_3 = NULL;
21990 static PyThread_type_lock __pyx_t_4[8];
21991 int __pyx_lineno = 0;
21992 const char *__pyx_filename = NULL;
21993 int __pyx_clineno = 0;
21994 __Pyx_RefNannyDeclarations
21995 #if CYTHON_PEP489_MULTI_PHASE_INIT
21997 if (__pyx_m == __pyx_pyinit_module)
return 0;
21998 PyErr_SetString(PyExc_RuntimeError,
"Module 'superluWrappers' has already been imported. Re-initialisation is not supported.");
22001 #elif PY_MAJOR_VERSION >= 3
22002 if (__pyx_m)
return __Pyx_NewRef(__pyx_m);
22004 #if CYTHON_REFNANNY
22005 __Pyx_RefNanny = __Pyx_RefNannyImportAPI(
"refnanny");
22006 if (!__Pyx_RefNanny) {
22008 __Pyx_RefNanny = __Pyx_RefNannyImportAPI(
"Cython.Runtime.refnanny");
22009 if (!__Pyx_RefNanny)
22010 Py_FatalError(
"failed to import 'refnanny' module");
22013 __Pyx_RefNannySetupContext(
"__Pyx_PyMODINIT_FUNC PyInit_superluWrappers(void)", 0);
22014 if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22015 #ifdef __Pxy_PyFrame_Initialize_Offsets
22016 __Pxy_PyFrame_Initialize_Offsets();
22018 __pyx_empty_tuple = PyTuple_New(0);
if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
22019 __pyx_empty_bytes = PyBytes_FromStringAndSize(
"", 0);
if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
22020 __pyx_empty_unicode = PyUnicode_FromStringAndSize(
"", 0);
if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
22021 #ifdef __Pyx_CyFunction_USED
22022 if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22024 #ifdef __Pyx_FusedFunction_USED
22025 if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22027 #ifdef __Pyx_Coroutine_USED
22028 if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22030 #ifdef __Pyx_Generator_USED
22031 if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22033 #ifdef __Pyx_AsyncGen_USED
22034 if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22036 #ifdef __Pyx_StopAsyncIteration_USED
22037 if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22041 #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
22042 PyEval_InitThreads();
22045 #if CYTHON_PEP489_MULTI_PHASE_INIT
22046 __pyx_m = __pyx_pyinit_module;
22047 Py_INCREF(__pyx_m);
22049 #if PY_MAJOR_VERSION < 3
22050 __pyx_m = Py_InitModule4(
"superluWrappers", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
22052 __pyx_m = PyModule_Create(&__pyx_moduledef);
22054 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
22056 __pyx_d = PyModule_GetDict(__pyx_m);
if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
22057 Py_INCREF(__pyx_d);
22058 __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME);
if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
22059 Py_INCREF(__pyx_b);
22060 __pyx_cython_runtime = PyImport_AddModule((
char *)
"cython_runtime");
if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
22061 Py_INCREF(__pyx_cython_runtime);
22062 if (PyObject_SetAttrString(__pyx_m,
"__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
22064 if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22065 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
22066 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22068 if (__pyx_module_is_main_superluWrappers) {
22069 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22071 #if PY_MAJOR_VERSION >= 3
22073 PyObject *modules = PyImport_GetModuleDict();
if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
22074 if (!PyDict_GetItemString(modules,
"superluWrappers")) {
22075 if (unlikely(PyDict_SetItemString(modules,
"superluWrappers", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
22080 if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22082 if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22084 (void)__Pyx_modinit_global_init_code();
22085 (void)__Pyx_modinit_variable_export_code();
22086 (void)__Pyx_modinit_function_export_code();
22087 if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
22088 if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
22089 (void)__Pyx_modinit_variable_import_code();
22090 (void)__Pyx_modinit_function_import_code();
22092 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
22093 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22103 __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error)
22104 __Pyx_GOTREF(__pyx_t_1);
22105 if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 7, __pyx_L1_error)
22106 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22115 __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__26);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error)
22116 __Pyx_GOTREF(__pyx_t_1);
22117 __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_tuple__26, __pyx_n_s_SparseMatrix, __pyx_n_s_SparseMatrix, (PyObject *) NULL, __pyx_n_s_superluWrappers, (PyObject *) NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error)
22118 __Pyx_GOTREF(__pyx_t_2);
22127 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_15superluWrappers_12SparseMatrix_1__init__, 0, __pyx_n_s_SparseMatrix___init, NULL, __pyx_n_s_superluWrappers, __pyx_d, ((PyObject *)__pyx_codeobj__28));
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 15, __pyx_L1_error)
22128 __Pyx_GOTREF(__pyx_t_3);
22129 if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init, __pyx_t_3) < 0) __PYX_ERR(0, 15, __pyx_L1_error)
22130 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22139 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_15superluWrappers_12SparseMatrix_3matvec, 0, __pyx_n_s_SparseMatrix_matvec, NULL, __pyx_n_s_superluWrappers, __pyx_d, ((PyObject *)__pyx_codeobj__30));
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 35, __pyx_L1_error)
22140 __Pyx_GOTREF(__pyx_t_3);
22141 if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_matvec, __pyx_t_3) < 0) __PYX_ERR(0, 35, __pyx_L1_error)
22142 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22151 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_15superluWrappers_12SparseMatrix_5fwrite, 0, __pyx_n_s_SparseMatrix_fwrite, NULL, __pyx_n_s_superluWrappers, __pyx_d, ((PyObject *)__pyx_codeobj__32));
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 46, __pyx_L1_error)
22152 __Pyx_GOTREF(__pyx_t_3);
22153 if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_fwrite, __pyx_t_3) < 0) __PYX_ERR(0, 46, __pyx_L1_error)
22154 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22163 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_15superluWrappers_12SparseMatrix_7getCSRrepresentation, 0, __pyx_n_s_SparseMatrix_getCSRrepresentatio, NULL, __pyx_n_s_superluWrappers, __pyx_d, ((PyObject *)__pyx_codeobj__34));
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 62, __pyx_L1_error)
22164 __Pyx_GOTREF(__pyx_t_3);
22165 if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_getCSRrepresentation, __pyx_t_3) < 0) __PYX_ERR(0, 62, __pyx_L1_error)
22166 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22175 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_15superluWrappers_12SparseMatrix_9getSubMatCSRrepresentation, 0, __pyx_n_s_SparseMatrix_getSubMatCSRreprese, NULL, __pyx_n_s_superluWrappers, __pyx_d, ((PyObject *)__pyx_codeobj__36));
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 72, __pyx_L1_error)
22176 __Pyx_GOTREF(__pyx_t_3);
22177 if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_getSubMatCSRrepresentation, __pyx_t_3) < 0) __PYX_ERR(0, 72, __pyx_L1_error)
22178 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22187 __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_SparseMatrix, __pyx_tuple__26, __pyx_t_2, NULL, 0, 1);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 13, __pyx_L1_error)
22188 __Pyx_GOTREF(__pyx_t_3);
22189 if (PyDict_SetItem(__pyx_d, __pyx_n_s_SparseMatrix, __pyx_t_3) < 0) __PYX_ERR(0, 13, __pyx_L1_error)
22190 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22191 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22192 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22201 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_15superluWrappers_1sparseFactorPrepare, NULL, __pyx_n_s_superluWrappers);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 219, __pyx_L1_error)
22202 __Pyx_GOTREF(__pyx_t_1);
22203 if (PyDict_SetItem(__pyx_d, __pyx_n_s_sparseFactorPrepare, __pyx_t_1) < 0) __PYX_ERR(0, 219, __pyx_L1_error)
22204 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22213 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_15superluWrappers_3sparseFactorSolve, NULL, __pyx_n_s_superluWrappers);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 286, __pyx_L1_error)
22214 __Pyx_GOTREF(__pyx_t_1);
22215 if (PyDict_SetItem(__pyx_d, __pyx_n_s_sparseFactorSolve, __pyx_t_1) < 0) __PYX_ERR(0, 286, __pyx_L1_error)
22216 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22223 __pyx_t_1 = __Pyx_PyDict_NewPresized(0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
22224 __Pyx_GOTREF(__pyx_t_1);
22225 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22226 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22235 __pyx_t_1 = __pyx_capsule_create(((
void *)(&__pyx_array_getbuffer)), ((
char *)
"getbuffer(obj, view, flags)"));
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 209, __pyx_L1_error)
22236 __Pyx_GOTREF(__pyx_t_1);
22237 if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(1, 209, __pyx_L1_error)
22238 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22239 PyType_Modified(__pyx_array_type);
22248 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__41, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 286, __pyx_L1_error)
22249 __Pyx_GOTREF(__pyx_t_1);
22250 __Pyx_XGOTREF(
generic);
22251 __Pyx_DECREF_SET(
generic, __pyx_t_1);
22252 __Pyx_GIVEREF(__pyx_t_1);
22262 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__42, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 287, __pyx_L1_error)
22263 __Pyx_GOTREF(__pyx_t_1);
22264 __Pyx_XGOTREF(strided);
22265 __Pyx_DECREF_SET(strided, __pyx_t_1);
22266 __Pyx_GIVEREF(__pyx_t_1);
22276 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__43, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 288, __pyx_L1_error)
22277 __Pyx_GOTREF(__pyx_t_1);
22278 __Pyx_XGOTREF(indirect);
22279 __Pyx_DECREF_SET(indirect, __pyx_t_1);
22280 __Pyx_GIVEREF(__pyx_t_1);
22290 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__44, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 291, __pyx_L1_error)
22291 __Pyx_GOTREF(__pyx_t_1);
22292 __Pyx_XGOTREF(contiguous);
22293 __Pyx_DECREF_SET(contiguous, __pyx_t_1);
22294 __Pyx_GIVEREF(__pyx_t_1);
22304 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__45, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 292, __pyx_L1_error)
22305 __Pyx_GOTREF(__pyx_t_1);
22306 __Pyx_XGOTREF(indirect_contiguous);
22307 __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_1);
22308 __Pyx_GIVEREF(__pyx_t_1);
22318 __pyx_memoryview_thread_locks_used = 0;
22327 __pyx_t_4[0] = PyThread_allocate_lock();
22328 __pyx_t_4[1] = PyThread_allocate_lock();
22329 __pyx_t_4[2] = PyThread_allocate_lock();
22330 __pyx_t_4[3] = PyThread_allocate_lock();
22331 __pyx_t_4[4] = PyThread_allocate_lock();
22332 __pyx_t_4[5] = PyThread_allocate_lock();
22333 __pyx_t_4[6] = PyThread_allocate_lock();
22334 __pyx_t_4[7] = PyThread_allocate_lock();
22335 memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_4,
sizeof(__pyx_memoryview_thread_locks[0]) * (8));
22344 __pyx_t_1 = __pyx_capsule_create(((
void *)(&__pyx_memoryview_getbuffer)), ((
char *)
"getbuffer(obj, view, flags)"));
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 549, __pyx_L1_error)
22345 __Pyx_GOTREF(__pyx_t_1);
22346 if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(1, 549, __pyx_L1_error)
22347 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22348 PyType_Modified(__pyx_memoryview_type);
22357 __pyx_t_1 = __pyx_capsule_create(((
void *)(&__pyx_memoryview_getbuffer)), ((
char *)
"getbuffer(obj, view, flags)"));
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 995, __pyx_L1_error)
22358 __Pyx_GOTREF(__pyx_t_1);
22359 if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(1, 995, __pyx_L1_error)
22360 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22361 PyType_Modified(__pyx_memoryviewslice_type);
22368 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
22369 __Pyx_GOTREF(__pyx_t_1);
22370 if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
22371 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22385 __Pyx_XDECREF(__pyx_t_1);
22386 __Pyx_XDECREF(__pyx_t_2);
22387 __Pyx_XDECREF(__pyx_t_3);
22390 __Pyx_AddTraceback(
"init superluWrappers", __pyx_clineno, __pyx_lineno, __pyx_filename);
22393 }
else if (!PyErr_Occurred()) {
22394 PyErr_SetString(PyExc_ImportError,
"init superluWrappers");
22397 __Pyx_RefNannyFinishContext();
22398 #if CYTHON_PEP489_MULTI_PHASE_INIT
22399 return (__pyx_m != NULL) ? 0 : -1;
22400 #elif PY_MAJOR_VERSION >= 3
22409 #if CYTHON_REFNANNY
22410 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(
const char *modname) {
22411 PyObject *m = NULL, *p = NULL;
22413 m = PyImport_ImportModule(modname);
22415 p = PyObject_GetAttrString(m,
"RefNannyAPI");
22417 r = PyLong_AsVoidPtr(p);
22421 return (__Pyx_RefNannyAPIStruct *)
r;
22426 #if CYTHON_USE_TYPE_SLOTS
22427 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
22428 PyTypeObject* tp = Py_TYPE(obj);
22429 if (likely(tp->tp_getattro))
22430 return tp->tp_getattro(obj, attr_name);
22431 #if PY_MAJOR_VERSION < 3
22432 if (likely(tp->tp_getattr))
22433 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
22435 return PyObject_GetAttr(obj, attr_name);
22440 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
22441 PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
22442 if (unlikely(!result)) {
22443 PyErr_Format(PyExc_NameError,
22444 #
if PY_MAJOR_VERSION >= 3
22445 "name '%U' is not defined", name);
22447 "name '%.200s' is not defined", PyString_AS_STRING(name));
22454 static void __Pyx_RaiseArgtupleInvalid(
22455 const char* func_name,
22457 Py_ssize_t num_min,
22458 Py_ssize_t num_max,
22459 Py_ssize_t num_found)
22461 Py_ssize_t num_expected;
22462 const char *more_or_less;
22463 if (num_found < num_min) {
22464 num_expected = num_min;
22465 more_or_less =
"at least";
22467 num_expected = num_max;
22468 more_or_less =
"at most";
22471 more_or_less =
"exactly";
22473 PyErr_Format(PyExc_TypeError,
22474 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T
"d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T
"d given)",
22475 func_name, more_or_less, num_expected,
22476 (num_expected == 1) ?
"" :
"s", num_found);
22480 static void __Pyx_RaiseDoubleKeywordsError(
22481 const char* func_name,
22484 PyErr_Format(PyExc_TypeError,
22485 #
if PY_MAJOR_VERSION >= 3
22486 "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
22488 "%s() got multiple values for keyword argument '%s'", func_name,
22489 PyString_AsString(kw_name));
22494 static int __Pyx_ParseOptionalKeywords(
22496 PyObject **argnames[],
22498 PyObject *values[],
22499 Py_ssize_t num_pos_args,
22500 const char* function_name)
22502 PyObject *key = 0, *value = 0;
22503 Py_ssize_t
pos = 0;
22505 PyObject*** first_kw_arg = argnames + num_pos_args;
22506 while (PyDict_Next(kwds, &
pos, &key, &value)) {
22507 name = first_kw_arg;
22508 while (*name && (**name != key)) name++;
22510 values[name-argnames] = value;
22513 name = first_kw_arg;
22514 #if PY_MAJOR_VERSION < 3
22515 if (likely(PyString_Check(key))) {
22517 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
22518 && _PyString_Eq(**name, key)) {
22519 values[name-argnames] = value;
22524 if (*name)
continue;
22526 PyObject*** argname = argnames;
22527 while (argname != first_kw_arg) {
22528 if ((**argname == key) || (
22529 (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
22530 && _PyString_Eq(**argname, key))) {
22531 goto arg_passed_twice;
22538 if (likely(PyUnicode_Check(key))) {
22540 int cmp = (**name == key) ? 0 :
22541 #
if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
22542 (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
22544 PyUnicode_Compare(**name, key);
22545 if (cmp < 0 && unlikely(PyErr_Occurred()))
goto bad;
22547 values[name-argnames] = value;
22552 if (*name)
continue;
22554 PyObject*** argname = argnames;
22555 while (argname != first_kw_arg) {
22556 int cmp = (**argname == key) ? 0 :
22557 #
if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
22558 (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
22560 PyUnicode_Compare(**argname, key);
22561 if (cmp < 0 && unlikely(PyErr_Occurred()))
goto bad;
22562 if (cmp == 0)
goto arg_passed_twice;
22567 goto invalid_keyword_type;
22569 if (unlikely(PyDict_SetItem(kwds2, key, value)))
goto bad;
22571 goto invalid_keyword;
22576 __Pyx_RaiseDoubleKeywordsError(function_name, key);
22578 invalid_keyword_type:
22579 PyErr_Format(PyExc_TypeError,
22580 "%.200s() keywords must be strings", function_name);
22583 PyErr_Format(PyExc_TypeError,
22584 #
if PY_MAJOR_VERSION < 3
22585 "%.200s() got an unexpected keyword argument '%.200s'",
22586 function_name, PyString_AsString(key));
22588 "%s() got an unexpected keyword argument '%U'",
22589 function_name, key);
22596 #if CYTHON_USE_TYPE_SLOTS
22597 static CYTHON_INLINE
int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
22598 PyTypeObject* tp = Py_TYPE(obj);
22599 if (likely(tp->tp_setattro))
22600 return tp->tp_setattro(obj, attr_name, value);
22601 #if PY_MAJOR_VERSION < 3
22602 if (likely(tp->tp_setattr))
22603 return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
22605 return PyObject_SetAttr(obj, attr_name, value);
22610 #if CYTHON_COMPILING_IN_CPYTHON
22611 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
22613 ternaryfunc call = Py_TYPE(func)->tp_call;
22614 if (unlikely(!call))
22615 return PyObject_Call(func, arg, kw);
22616 if (unlikely(Py_EnterRecursiveCall((
char*)
" while calling a Python object")))
22618 result = (*call)(func, arg, kw);
22619 Py_LeaveRecursiveCall();
22620 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
22623 "NULL result without error in PyObject_Call");
22630 static CYTHON_INLINE
int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
22631 if (unlikely(!type)) {
22632 PyErr_SetString(PyExc_SystemError,
"Missing type object");
22635 if (likely(__Pyx_TypeCheck(obj, type)))
22637 PyErr_Format(PyExc_TypeError,
"Cannot convert %.200s to %.200s",
22638 Py_TYPE(obj)->tp_name, type->tp_name);
22644 __Pyx_init_memviewslice(
struct __pyx_memoryview_obj *memview,
22646 __Pyx_memviewslice *memviewslice,
22647 int memview_is_new_reference)
22649 __Pyx_RefNannyDeclarations
22651 Py_buffer *buf = &memview->view;
22652 __Pyx_RefNannySetupContext(
"init_memviewslice", 0);
22653 if (unlikely(memviewslice->memview || memviewslice->data)) {
22654 PyErr_SetString(PyExc_ValueError,
22655 "memviewslice is already initialized!");
22658 if (buf->strides) {
22659 for (i = 0; i < ndim; i++) {
22660 memviewslice->strides[i] = buf->strides[i];
22663 Py_ssize_t stride = buf->itemsize;
22664 for (i = ndim - 1; i >= 0; i--) {
22665 memviewslice->strides[i] = stride;
22666 stride *= buf->shape[i];
22669 for (i = 0; i < ndim; i++) {
22670 memviewslice->shape[i] = buf->shape[i];
22671 if (buf->suboffsets) {
22672 memviewslice->suboffsets[i] = buf->suboffsets[i];
22674 memviewslice->suboffsets[i] = -1;
22677 memviewslice->memview = memview;
22678 memviewslice->data = (
char *)buf->buf;
22679 if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) {
22680 Py_INCREF(memview);
22685 memviewslice->memview = 0;
22686 memviewslice->data = 0;
22689 __Pyx_RefNannyFinishContext();
22692 #ifndef Py_NO_RETURN
22693 #define Py_NO_RETURN
22695 static void __pyx_fatalerror(
const char *fmt, ...) Py_NO_RETURN {
22698 #ifdef HAVE_STDARG_PROTOTYPES
22699 va_start(vargs, fmt);
22703 vsnprintf(msg, 200, fmt, vargs);
22705 Py_FatalError(msg);
22707 static CYTHON_INLINE
int
22708 __pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
22709 PyThread_type_lock lock)
22712 PyThread_acquire_lock(lock, 1);
22713 result = (*acquisition_count)++;
22714 PyThread_release_lock(lock);
22717 static CYTHON_INLINE
int
22718 __pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
22719 PyThread_type_lock lock)
22722 PyThread_acquire_lock(lock, 1);
22723 result = (*acquisition_count)--;
22724 PyThread_release_lock(lock);
22727 static CYTHON_INLINE
void
22728 __Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice,
int have_gil,
int lineno)
22731 struct __pyx_memoryview_obj *memview = memslice->memview;
22732 if (unlikely(!memview || (PyObject *) memview == Py_None))
22734 if (unlikely(__pyx_get_slice_count(memview) < 0))
22735 __pyx_fatalerror(
"Acquisition count is %d (line %d)",
22736 __pyx_get_slice_count(memview), lineno);
22737 first_time = __pyx_add_acquisition_count(memview) == 0;
22738 if (unlikely(first_time)) {
22740 Py_INCREF((PyObject *) memview);
22742 PyGILState_STATE _gilstate = PyGILState_Ensure();
22743 Py_INCREF((PyObject *) memview);
22744 PyGILState_Release(_gilstate);
22748 static CYTHON_INLINE
void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice,
22749 int have_gil,
int lineno) {
22751 struct __pyx_memoryview_obj *memview = memslice->memview;
22752 if (unlikely(!memview || (PyObject *) memview == Py_None)) {
22753 memslice->memview = NULL;
22756 if (unlikely(__pyx_get_slice_count(memview) <= 0))
22757 __pyx_fatalerror(
"Acquisition count is %d (line %d)",
22758 __pyx_get_slice_count(memview), lineno);
22759 last_time = __pyx_sub_acquisition_count(memview) == 1;
22760 memslice->data = NULL;
22761 if (unlikely(last_time)) {
22763 Py_CLEAR(memslice->memview);
22765 PyGILState_STATE _gilstate = PyGILState_Ensure();
22766 Py_CLEAR(memslice->memview);
22767 PyGILState_Release(_gilstate);
22770 memslice->memview = NULL;
22775 #if CYTHON_FAST_PYCALL
22776 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
22777 PyObject *globals) {
22779 PyThreadState *tstate = __Pyx_PyThreadState_Current;
22780 PyObject **fastlocals;
22783 assert(globals != NULL);
22788 assert(tstate != NULL);
22789 f = PyFrame_New(tstate, co, globals, NULL);
22793 fastlocals = __Pyx_PyFrame_GetLocalsplus(
f);
22794 for (i = 0; i < na; i++) {
22796 fastlocals[i] = *args++;
22798 result = PyEval_EvalFrameEx(
f,0);
22799 ++tstate->recursion_depth;
22801 --tstate->recursion_depth;
22804 #if 1 || PY_VERSION_HEX < 0x030600B1
22805 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
22806 PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
22807 PyObject *globals = PyFunction_GET_GLOBALS(func);
22808 PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
22810 #if PY_MAJOR_VERSION >= 3
22813 PyObject *kwtuple, **k;
22818 assert(kwargs == NULL || PyDict_Check(kwargs));
22819 nk = kwargs ? PyDict_Size(kwargs) : 0;
22820 if (Py_EnterRecursiveCall((
char*)
" while calling a Python object")) {
22824 #
if PY_MAJOR_VERSION >= 3
22825 co->co_kwonlyargcount == 0 &&
22827 likely(kwargs == NULL || nk == 0) &&
22828 co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
22829 if (argdefs == NULL && co->co_argcount == nargs) {
22830 result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
22833 else if (nargs == 0 && argdefs != NULL
22834 && co->co_argcount == Py_SIZE(argdefs)) {
22837 args = &PyTuple_GET_ITEM(argdefs, 0);
22838 result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
22842 if (kwargs != NULL) {
22844 kwtuple = PyTuple_New(2 * nk);
22845 if (kwtuple == NULL) {
22849 k = &PyTuple_GET_ITEM(kwtuple, 0);
22851 while (PyDict_Next(kwargs, &
pos, &k[i], &k[i+1])) {
22862 closure = PyFunction_GET_CLOSURE(func);
22863 #if PY_MAJOR_VERSION >= 3
22864 kwdefs = PyFunction_GET_KW_DEFAULTS(func);
22866 if (argdefs != NULL) {
22867 d = &PyTuple_GET_ITEM(argdefs, 0);
22868 nd = Py_SIZE(argdefs);
22874 #if PY_MAJOR_VERSION >= 3
22875 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
22878 d, (
int)nd, kwdefs, closure);
22880 result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
22883 d, (
int)nd, closure);
22885 Py_XDECREF(kwtuple);
22887 Py_LeaveRecursiveCall();
22894 #if CYTHON_COMPILING_IN_CPYTHON
22895 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
22896 PyObject *
self, *result;
22898 cfunc = PyCFunction_GET_FUNCTION(func);
22899 self = PyCFunction_GET_SELF(func);
22900 if (unlikely(Py_EnterRecursiveCall((
char*)
" while calling a Python object")))
22902 result = cfunc(
self, arg);
22903 Py_LeaveRecursiveCall();
22904 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
22907 "NULL result without error in PyObject_Call");
22914 #if CYTHON_COMPILING_IN_CPYTHON
22915 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
22916 #if CYTHON_FAST_PYCALL
22917 if (PyFunction_Check(func)) {
22918 return __Pyx_PyFunction_FastCall(func, NULL, 0);
22921 #ifdef __Pyx_CyFunction_USED
22922 if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
22924 if (likely(PyCFunction_Check(func)))
22927 if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
22928 return __Pyx_PyObject_CallMethO(func, NULL);
22931 return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
22936 #if CYTHON_FAST_PYCCALL
22937 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
22938 PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
22939 PyCFunction meth = PyCFunction_GET_FUNCTION(func);
22940 PyObject *
self = PyCFunction_GET_SELF(func);
22941 int flags = PyCFunction_GET_FLAGS(func);
22942 assert(PyCFunction_Check(func));
22943 assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
22944 assert(nargs >= 0);
22945 assert(nargs == 0 || args != NULL);
22949 assert(!PyErr_Occurred());
22950 if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
22951 return (*((__Pyx_PyCFunctionFastWithKeywords)(
void*)meth)) (
self, args, nargs, NULL);
22953 return (*((__Pyx_PyCFunctionFast)(
void*)meth)) (
self, args, nargs);
22959 #if CYTHON_COMPILING_IN_CPYTHON
22960 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
22962 PyObject *args = PyTuple_New(1);
22963 if (unlikely(!args))
return NULL;
22965 PyTuple_SET_ITEM(args, 0, arg);
22966 result = __Pyx_PyObject_Call(func, args, NULL);
22970 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
22971 #if CYTHON_FAST_PYCALL
22972 if (PyFunction_Check(func)) {
22973 return __Pyx_PyFunction_FastCall(func, &arg, 1);
22976 if (likely(PyCFunction_Check(func))) {
22977 if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
22978 return __Pyx_PyObject_CallMethO(func, arg);
22979 #if CYTHON_FAST_PYCCALL
22980 }
else if (__Pyx_PyFastCFunction_Check(func)) {
22981 return __Pyx_PyCFunction_FastCall(func, &arg, 1);
22985 return __Pyx__PyObject_CallOneArg(func, arg);
22988 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
22990 PyObject *args = PyTuple_Pack(1, arg);
22991 if (unlikely(!args))
return NULL;
22992 result = __Pyx_PyObject_Call(func, args, NULL);
22999 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
23001 if (!j)
return NULL;
23002 r = PyObject_GetItem(o, j);
23006 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
23007 CYTHON_NCP_UNUSED
int wraparound,
23008 CYTHON_NCP_UNUSED
int boundscheck) {
23009 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
23010 Py_ssize_t wrapped_i = i;
23011 if (wraparound & unlikely(i < 0)) {
23012 wrapped_i += PyList_GET_SIZE(o);
23014 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
23015 PyObject *
r = PyList_GET_ITEM(o, wrapped_i);
23019 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
23021 return PySequence_GetItem(o, i);
23024 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
23025 CYTHON_NCP_UNUSED
int wraparound,
23026 CYTHON_NCP_UNUSED
int boundscheck) {
23027 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
23028 Py_ssize_t wrapped_i = i;
23029 if (wraparound & unlikely(i < 0)) {
23030 wrapped_i += PyTuple_GET_SIZE(o);
23032 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
23033 PyObject *
r = PyTuple_GET_ITEM(o, wrapped_i);
23037 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
23039 return PySequence_GetItem(o, i);
23042 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
int is_list,
23043 CYTHON_NCP_UNUSED
int wraparound,
23044 CYTHON_NCP_UNUSED
int boundscheck) {
23045 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
23046 if (is_list || PyList_CheckExact(o)) {
23047 Py_ssize_t
n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
23048 if ((!boundscheck) || (likely(__Pyx_is_valid_index(
n, PyList_GET_SIZE(o))))) {
23049 PyObject *
r = PyList_GET_ITEM(o,
n);
23054 else if (PyTuple_CheckExact(o)) {
23055 Py_ssize_t
n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
23056 if ((!boundscheck) || likely(__Pyx_is_valid_index(
n, PyTuple_GET_SIZE(o)))) {
23057 PyObject *
r = PyTuple_GET_ITEM(o,
n);
23062 PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
23063 if (likely(m && m->sq_item)) {
23064 if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
23065 Py_ssize_t l = m->sq_length(o);
23066 if (likely(l >= 0)) {
23069 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
23074 return m->sq_item(o, i);
23078 if (is_list || PySequence_Check(o)) {
23079 return PySequence_GetItem(o, i);
23082 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
23086 #if CYTHON_USE_TYPE_SLOTS
23087 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
23089 Py_ssize_t key_value;
23090 PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
23091 if (unlikely(!(m && m->sq_item))) {
23092 PyErr_Format(PyExc_TypeError,
"'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
23095 key_value = __Pyx_PyIndex_AsSsize_t(index);
23096 if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
23097 return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
23099 if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
23101 PyErr_Format(PyExc_IndexError,
"cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
23105 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
23106 PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
23107 if (likely(m && m->mp_subscript)) {
23108 return m->mp_subscript(obj, key);
23110 return __Pyx_PyObject_GetIndex(obj, key);
23115 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject*
function, PyObject* arg1, PyObject* arg2) {
23116 PyObject *args, *result = NULL;
23117 #if CYTHON_FAST_PYCALL
23118 if (PyFunction_Check(
function)) {
23119 PyObject *args[2] = {arg1, arg2};
23120 return __Pyx_PyFunction_FastCall(
function, args, 2);
23123 #if CYTHON_FAST_PYCCALL
23124 if (__Pyx_PyFastCFunction_Check(
function)) {
23125 PyObject *args[2] = {arg1, arg2};
23126 return __Pyx_PyCFunction_FastCall(
function, args, 2);
23129 args = PyTuple_New(2);
23130 if (unlikely(!args))
goto done;
23132 PyTuple_SET_ITEM(args, 0, arg1);
23134 PyTuple_SET_ITEM(args, 1, arg2);
23135 Py_INCREF(
function);
23136 result = __Pyx_PyObject_Call(
function, args, NULL);
23138 Py_DECREF(
function);
23144 #if !CYTHON_COMPILING_IN_PYPY
23145 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED
long intval,
int inplace,
int zerodivision_check) {
23147 (void)zerodivision_check;
23148 #if PY_MAJOR_VERSION < 3
23149 if (likely(PyInt_CheckExact(op1))) {
23150 const long b = intval;
23152 long a = PyInt_AS_LONG(op1);
23153 x = (long)((
unsigned long)a + b);
23154 if (likely((x^a) >= 0 || (x^b) >= 0))
23155 return PyInt_FromLong(x);
23156 return PyLong_Type.tp_as_number->nb_add(op1, op2);
23159 #if CYTHON_USE_PYLONG_INTERNALS
23160 if (likely(PyLong_CheckExact(op1))) {
23161 const long b = intval;
23163 #ifdef HAVE_LONG_LONG
23164 const PY_LONG_LONG llb = intval;
23165 PY_LONG_LONG lla, llx;
23167 const digit* digits = ((PyLongObject*)op1)->ob_digit;
23168 const Py_ssize_t size = Py_SIZE(op1);
23169 if (likely(__Pyx_sst_abs(size) <= 1)) {
23170 a = likely(size) ? digits[0] : 0;
23171 if (size == -1) a = -a;
23175 if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
23176 a = -(long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
23178 #ifdef HAVE_LONG_LONG
23179 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
23180 lla = -(PY_LONG_LONG) (((((
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
23184 CYTHON_FALLTHROUGH;
23186 if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
23187 a = (long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
23189 #ifdef HAVE_LONG_LONG
23190 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
23191 lla = (PY_LONG_LONG) (((((
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
23195 CYTHON_FALLTHROUGH;
23197 if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
23198 a = -(long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
23200 #ifdef HAVE_LONG_LONG
23201 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
23202 lla = -(PY_LONG_LONG) (((((((
unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
23206 CYTHON_FALLTHROUGH;
23208 if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
23209 a = (long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
23211 #ifdef HAVE_LONG_LONG
23212 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
23213 lla = (PY_LONG_LONG) (((((((
unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
23217 CYTHON_FALLTHROUGH;
23219 if (8 *
sizeof(
long) - 1 > 4 * PyLong_SHIFT) {
23220 a = -(long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
23222 #ifdef HAVE_LONG_LONG
23223 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
23224 lla = -(PY_LONG_LONG) (((((((((
unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
23228 CYTHON_FALLTHROUGH;
23230 if (8 *
sizeof(
long) - 1 > 4 * PyLong_SHIFT) {
23231 a = (long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
23233 #ifdef HAVE_LONG_LONG
23234 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
23235 lla = (PY_LONG_LONG) (((((((((
unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
23239 CYTHON_FALLTHROUGH;
23240 default:
return PyLong_Type.tp_as_number->nb_add(op1, op2);
23244 return PyLong_FromLong(x);
23245 #ifdef HAVE_LONG_LONG
23248 return PyLong_FromLongLong(llx);
23254 if (PyFloat_CheckExact(op1)) {
23255 const long b = intval;
23256 double a = PyFloat_AS_DOUBLE(op1);
23258 PyFPE_START_PROTECT(
"add",
return NULL)
23259 result = ((double)a) + (double)b;
23260 PyFPE_END_PROTECT(result)
23261 return PyFloat_FromDouble(result);
23263 return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
23268 #if CYTHON_USE_EXC_INFO_STACK
23269 static _PyErr_StackItem *
23270 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
23272 _PyErr_StackItem *exc_info = tstate->exc_info;
23273 while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
23274 exc_info->previous_item != NULL)
23276 exc_info = exc_info->previous_item;
23283 #if CYTHON_FAST_THREAD_STATE
23284 static CYTHON_INLINE
void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
23285 #if CYTHON_USE_EXC_INFO_STACK
23286 _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
23287 *type = exc_info->exc_type;
23288 *value = exc_info->exc_value;
23289 *tb = exc_info->exc_traceback;
23291 *type = tstate->exc_type;
23292 *value = tstate->exc_value;
23293 *tb = tstate->exc_traceback;
23296 Py_XINCREF(*value);
23299 static CYTHON_INLINE
void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
23300 PyObject *tmp_type, *tmp_value, *tmp_tb;
23301 #if CYTHON_USE_EXC_INFO_STACK
23302 _PyErr_StackItem *exc_info = tstate->exc_info;
23303 tmp_type = exc_info->exc_type;
23304 tmp_value = exc_info->exc_value;
23305 tmp_tb = exc_info->exc_traceback;
23306 exc_info->exc_type = type;
23307 exc_info->exc_value = value;
23308 exc_info->exc_traceback = tb;
23310 tmp_type = tstate->exc_type;
23311 tmp_value = tstate->exc_value;
23312 tmp_tb = tstate->exc_traceback;
23313 tstate->exc_type = type;
23314 tstate->exc_value = value;
23315 tstate->exc_traceback = tb;
23317 Py_XDECREF(tmp_type);
23318 Py_XDECREF(tmp_value);
23319 Py_XDECREF(tmp_tb);
23324 #if CYTHON_FAST_THREAD_STATE
23325 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
23327 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
23330 PyObject *local_type, *local_value, *local_tb;
23331 #if CYTHON_FAST_THREAD_STATE
23332 PyObject *tmp_type, *tmp_value, *tmp_tb;
23333 local_type = tstate->curexc_type;
23334 local_value = tstate->curexc_value;
23335 local_tb = tstate->curexc_traceback;
23336 tstate->curexc_type = 0;
23337 tstate->curexc_value = 0;
23338 tstate->curexc_traceback = 0;
23340 PyErr_Fetch(&local_type, &local_value, &local_tb);
23342 PyErr_NormalizeException(&local_type, &local_value, &local_tb);
23343 #if CYTHON_FAST_THREAD_STATE
23344 if (unlikely(tstate->curexc_type))
23346 if (unlikely(PyErr_Occurred()))
23349 #if PY_MAJOR_VERSION >= 3
23351 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
23355 Py_XINCREF(local_tb);
23356 Py_XINCREF(local_type);
23357 Py_XINCREF(local_value);
23358 *type = local_type;
23359 *value = local_value;
23361 #if CYTHON_FAST_THREAD_STATE
23362 #if CYTHON_USE_EXC_INFO_STACK
23364 _PyErr_StackItem *exc_info = tstate->exc_info;
23365 tmp_type = exc_info->exc_type;
23366 tmp_value = exc_info->exc_value;
23367 tmp_tb = exc_info->exc_traceback;
23368 exc_info->exc_type = local_type;
23369 exc_info->exc_value = local_value;
23370 exc_info->exc_traceback = local_tb;
23373 tmp_type = tstate->exc_type;
23374 tmp_value = tstate->exc_value;
23375 tmp_tb = tstate->exc_traceback;
23376 tstate->exc_type = local_type;
23377 tstate->exc_value = local_value;
23378 tstate->exc_traceback = local_tb;
23380 Py_XDECREF(tmp_type);
23381 Py_XDECREF(tmp_value);
23382 Py_XDECREF(tmp_tb);
23384 PyErr_SetExcInfo(local_type, local_value, local_tb);
23391 Py_XDECREF(local_type);
23392 Py_XDECREF(local_value);
23393 Py_XDECREF(local_tb);
23398 #if CYTHON_FAST_THREAD_STATE
23399 static CYTHON_INLINE
void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
23400 PyObject *tmp_type, *tmp_value, *tmp_tb;
23401 tmp_type = tstate->curexc_type;
23402 tmp_value = tstate->curexc_value;
23403 tmp_tb = tstate->curexc_traceback;
23404 tstate->curexc_type = type;
23405 tstate->curexc_value = value;
23406 tstate->curexc_traceback = tb;
23407 Py_XDECREF(tmp_type);
23408 Py_XDECREF(tmp_value);
23409 Py_XDECREF(tmp_tb);
23411 static CYTHON_INLINE
void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
23412 *type = tstate->curexc_type;
23413 *value = tstate->curexc_value;
23414 *tb = tstate->curexc_traceback;
23415 tstate->curexc_type = 0;
23416 tstate->curexc_value = 0;
23417 tstate->curexc_traceback = 0;
23422 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj,
23423 Py_ssize_t cstart, Py_ssize_t cstop,
23424 PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
23425 int has_cstart,
int has_cstop, CYTHON_UNUSED
int wraparound) {
23426 #if CYTHON_USE_TYPE_SLOTS
23427 PyMappingMethods* mp;
23428 #if PY_MAJOR_VERSION < 3
23429 PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
23430 if (likely(ms && ms->sq_slice)) {
23432 if (_py_start && (*_py_start != Py_None)) {
23433 cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
23434 if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred())
goto bad;
23439 if (_py_stop && (*_py_stop != Py_None)) {
23440 cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
23441 if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred())
goto bad;
23443 cstop = PY_SSIZE_T_MAX;
23445 if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
23446 Py_ssize_t l = ms->sq_length(obj);
23447 if (likely(l >= 0)) {
23450 if (cstop < 0) cstop = 0;
23454 if (cstart < 0) cstart = 0;
23457 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
23462 return ms->sq_slice(obj, cstart, cstop);
23465 mp = Py_TYPE(obj)->tp_as_mapping;
23466 if (likely(mp && mp->mp_subscript))
23470 PyObject *py_slice, *py_start, *py_stop;
23472 py_slice = *_py_slice;
23474 PyObject* owned_start = NULL;
23475 PyObject* owned_stop = NULL;
23477 py_start = *_py_start;
23480 owned_start = py_start = PyInt_FromSsize_t(cstart);
23481 if (unlikely(!py_start))
goto bad;
23483 py_start = Py_None;
23486 py_stop = *_py_stop;
23489 owned_stop = py_stop = PyInt_FromSsize_t(cstop);
23490 if (unlikely(!py_stop)) {
23491 Py_XDECREF(owned_start);
23497 py_slice = PySlice_New(py_start, py_stop, Py_None);
23498 Py_XDECREF(owned_start);
23499 Py_XDECREF(owned_stop);
23500 if (unlikely(!py_slice))
goto bad;
23502 #if CYTHON_USE_TYPE_SLOTS
23503 result = mp->mp_subscript(obj, py_slice);
23505 result = PyObject_GetItem(obj, py_slice);
23508 Py_DECREF(py_slice);
23512 PyErr_Format(PyExc_TypeError,
23513 "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name);
23519 #if PY_MAJOR_VERSION < 3
23520 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
23521 CYTHON_UNUSED PyObject *cause) {
23522 __Pyx_PyThreadState_declare
23524 if (!value || value == Py_None)
23528 if (!tb || tb == Py_None)
23532 if (!PyTraceBack_Check(tb)) {
23533 PyErr_SetString(PyExc_TypeError,
23534 "raise: arg 3 must be a traceback or None");
23538 if (PyType_Check(type)) {
23539 #if CYTHON_COMPILING_IN_PYPY
23541 Py_INCREF(Py_None);
23545 PyErr_NormalizeException(&type, &value, &tb);
23548 PyErr_SetString(PyExc_TypeError,
23549 "instance exception may not have a separate value");
23553 type = (PyObject*) Py_TYPE(type);
23555 if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
23556 PyErr_SetString(PyExc_TypeError,
23557 "raise: exception class must be a subclass of BaseException");
23561 __Pyx_PyThreadState_assign
23562 __Pyx_ErrRestore(type, value, tb);
23571 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
23572 PyObject* owned_instance = NULL;
23573 if (tb == Py_None) {
23575 }
else if (tb && !PyTraceBack_Check(tb)) {
23576 PyErr_SetString(PyExc_TypeError,
23577 "raise: arg 3 must be a traceback or None");
23580 if (value == Py_None)
23582 if (PyExceptionInstance_Check(type)) {
23584 PyErr_SetString(PyExc_TypeError,
23585 "instance exception may not have a separate value");
23589 type = (PyObject*) Py_TYPE(value);
23590 }
else if (PyExceptionClass_Check(type)) {
23591 PyObject *instance_class = NULL;
23592 if (value && PyExceptionInstance_Check(value)) {
23593 instance_class = (PyObject*) Py_TYPE(value);
23594 if (instance_class != type) {
23595 int is_subclass = PyObject_IsSubclass(instance_class, type);
23596 if (!is_subclass) {
23597 instance_class = NULL;
23598 }
else if (unlikely(is_subclass == -1)) {
23601 type = instance_class;
23605 if (!instance_class) {
23608 args = PyTuple_New(0);
23609 else if (PyTuple_Check(value)) {
23613 args = PyTuple_Pack(1, value);
23616 owned_instance = PyObject_Call(type, args, NULL);
23618 if (!owned_instance)
23620 value = owned_instance;
23621 if (!PyExceptionInstance_Check(value)) {
23622 PyErr_Format(PyExc_TypeError,
23623 "calling %R should have returned an instance of "
23624 "BaseException, not %R",
23625 type, Py_TYPE(value));
23630 PyErr_SetString(PyExc_TypeError,
23631 "raise: exception class must be a subclass of BaseException");
23635 PyObject *fixed_cause;
23636 if (cause == Py_None) {
23637 fixed_cause = NULL;
23638 }
else if (PyExceptionClass_Check(cause)) {
23639 fixed_cause = PyObject_CallObject(cause, NULL);
23640 if (fixed_cause == NULL)
23642 }
else if (PyExceptionInstance_Check(cause)) {
23643 fixed_cause = cause;
23644 Py_INCREF(fixed_cause);
23646 PyErr_SetString(PyExc_TypeError,
23647 "exception causes must derive from "
23651 PyException_SetCause(value, fixed_cause);
23653 PyErr_SetObject(type, value);
23655 #if CYTHON_COMPILING_IN_PYPY
23656 PyObject *tmp_type, *tmp_value, *tmp_tb;
23657 PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
23659 PyErr_Restore(tmp_type, tmp_value, tb);
23660 Py_XDECREF(tmp_tb);
23662 PyThreadState *tstate = __Pyx_PyThreadState_Current;
23663 PyObject* tmp_tb = tstate->curexc_traceback;
23664 if (tb != tmp_tb) {
23666 tstate->curexc_traceback = tb;
23667 Py_XDECREF(tmp_tb);
23672 Py_XDECREF(owned_instance);
23678 static void __Pyx_WriteUnraisable(
const char *name, CYTHON_UNUSED
int clineno,
23679 CYTHON_UNUSED
int lineno, CYTHON_UNUSED
const char *filename,
23680 int full_traceback, CYTHON_UNUSED
int nogil) {
23681 PyObject *old_exc, *old_val, *old_tb;
23683 __Pyx_PyThreadState_declare
23685 PyGILState_STATE state;
23687 state = PyGILState_Ensure();
23689 else state = (PyGILState_STATE)-1;
23692 __Pyx_PyThreadState_assign
23693 __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
23694 if (full_traceback) {
23695 Py_XINCREF(old_exc);
23696 Py_XINCREF(old_val);
23697 Py_XINCREF(old_tb);
23698 __Pyx_ErrRestore(old_exc, old_val, old_tb);
23701 #if PY_MAJOR_VERSION < 3
23702 ctx = PyString_FromString(name);
23704 ctx = PyUnicode_FromString(name);
23706 __Pyx_ErrRestore(old_exc, old_val, old_tb);
23708 PyErr_WriteUnraisable(Py_None);
23710 PyErr_WriteUnraisable(ctx);
23715 PyGILState_Release(state);
23720 #if CYTHON_FAST_THREAD_STATE
23721 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
23723 n = PyTuple_GET_SIZE(tuple);
23724 #if PY_MAJOR_VERSION >= 3
23725 for (i=0; i<
n; i++) {
23726 if (exc_type == PyTuple_GET_ITEM(tuple, i))
return 1;
23729 for (i=0; i<
n; i++) {
23730 if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i)))
return 1;
23734 static CYTHON_INLINE
int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
23735 PyObject *exc_type = tstate->curexc_type;
23736 if (exc_type == err)
return 1;
23737 if (unlikely(!exc_type))
return 0;
23738 if (unlikely(PyTuple_Check(err)))
23739 return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
23740 return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
23745 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type,
const char *name,
int exact)
23747 if (unlikely(!type)) {
23748 PyErr_SetString(PyExc_SystemError,
"Missing type object");
23752 #if PY_MAJOR_VERSION == 2
23753 if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj)))
return 1;
23757 if (likely(__Pyx_TypeCheck(obj, type)))
return 1;
23759 PyErr_Format(PyExc_TypeError,
23760 "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
23761 name, type->tp_name, Py_TYPE(obj)->tp_name);
23766 static CYTHON_INLINE
int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2,
int equals) {
23767 #if CYTHON_COMPILING_IN_PYPY
23768 return PyObject_RichCompareBool(s1, s2, equals);
23771 return (equals == Py_EQ);
23772 }
else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
23773 const char *ps1, *ps2;
23774 Py_ssize_t length = PyBytes_GET_SIZE(s1);
23775 if (length != PyBytes_GET_SIZE(s2))
23776 return (equals == Py_NE);
23777 ps1 = PyBytes_AS_STRING(s1);
23778 ps2 = PyBytes_AS_STRING(s2);
23779 if (ps1[0] != ps2[0]) {
23780 return (equals == Py_NE);
23781 }
else if (length == 1) {
23782 return (equals == Py_EQ);
23785 #if CYTHON_USE_UNICODE_INTERNALS
23786 Py_hash_t hash1, hash2;
23787 hash1 = ((PyBytesObject*)s1)->ob_shash;
23788 hash2 = ((PyBytesObject*)s2)->ob_shash;
23789 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
23790 return (equals == Py_NE);
23793 result = memcmp(ps1, ps2, (
size_t)length);
23794 return (equals == Py_EQ) ? (result == 0) : (result != 0);
23796 }
else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
23797 return (equals == Py_NE);
23798 }
else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
23799 return (equals == Py_NE);
23802 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
23805 result = __Pyx_PyObject_IsTrue(py_result);
23806 Py_DECREF(py_result);
23813 static CYTHON_INLINE
int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2,
int equals) {
23814 #if CYTHON_COMPILING_IN_PYPY
23815 return PyObject_RichCompareBool(s1, s2, equals);
23817 #if PY_MAJOR_VERSION < 3
23818 PyObject* owned_ref = NULL;
23820 int s1_is_unicode, s2_is_unicode;
23824 s1_is_unicode = PyUnicode_CheckExact(s1);
23825 s2_is_unicode = PyUnicode_CheckExact(s2);
23826 #if PY_MAJOR_VERSION < 3
23827 if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
23828 owned_ref = PyUnicode_FromObject(s2);
23829 if (unlikely(!owned_ref))
23833 }
else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
23834 owned_ref = PyUnicode_FromObject(s1);
23835 if (unlikely(!owned_ref))
23839 }
else if (((!s2_is_unicode) & (!s1_is_unicode))) {
23840 return __Pyx_PyBytes_Equals(s1, s2, equals);
23843 if (s1_is_unicode & s2_is_unicode) {
23846 void *data1, *data2;
23847 if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
23849 length = __Pyx_PyUnicode_GET_LENGTH(s1);
23850 if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
23853 #if CYTHON_USE_UNICODE_INTERNALS
23855 Py_hash_t hash1, hash2;
23856 #if CYTHON_PEP393_ENABLED
23857 hash1 = ((PyASCIIObject*)s1)->hash;
23858 hash2 = ((PyASCIIObject*)s2)->hash;
23860 hash1 = ((PyUnicodeObject*)s1)->hash;
23861 hash2 = ((PyUnicodeObject*)s2)->hash;
23863 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
23868 kind = __Pyx_PyUnicode_KIND(s1);
23869 if (kind != __Pyx_PyUnicode_KIND(s2)) {
23872 data1 = __Pyx_PyUnicode_DATA(s1);
23873 data2 = __Pyx_PyUnicode_DATA(s2);
23874 if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
23876 }
else if (length == 1) {
23879 int result = memcmp(data1, data2, (
size_t)(length * kind));
23880 #if PY_MAJOR_VERSION < 3
23881 Py_XDECREF(owned_ref);
23883 return (equals == Py_EQ) ? (result == 0) : (result != 0);
23885 }
else if ((s1 == Py_None) & s2_is_unicode) {
23887 }
else if ((s2 == Py_None) & s1_is_unicode) {
23891 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
23892 #if PY_MAJOR_VERSION < 3
23893 Py_XDECREF(owned_ref);
23897 result = __Pyx_PyObject_IsTrue(py_result);
23898 Py_DECREF(py_result);
23902 #if PY_MAJOR_VERSION < 3
23903 Py_XDECREF(owned_ref);
23905 return (equals == Py_EQ);
23907 #if PY_MAJOR_VERSION < 3
23908 Py_XDECREF(owned_ref);
23910 return (equals == Py_NE);
23915 static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) {
23916 Py_ssize_t
q = a / b;
23917 Py_ssize_t
r = a -
q*b;
23918 q -= ((
r != 0) & ((
r ^ b) < 0));
23923 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *
n) {
23924 #if CYTHON_USE_TYPE_SLOTS
23925 #if PY_MAJOR_VERSION >= 3
23926 if (likely(PyUnicode_Check(
n)))
23928 if (likely(PyString_Check(
n)))
23930 return __Pyx_PyObject_GetAttrStr(o,
n);
23932 return PyObject_GetAttr(o,
n);
23936 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
23937 const char* cstring, Py_ssize_t start, Py_ssize_t stop,
23938 const char* encoding,
const char* errors,
23939 PyObject* (*decode_func)(
const char *
s, Py_ssize_t size,
const char *errors)) {
23941 if (unlikely((start < 0) | (stop < 0))) {
23942 size_t slen = strlen(cstring);
23943 if (unlikely(slen > (
size_t) PY_SSIZE_T_MAX)) {
23944 PyErr_SetString(PyExc_OverflowError,
23945 "c-string too long to convert to Python");
23948 length = (Py_ssize_t) slen;
23957 if (unlikely(stop <= start))
23958 return __Pyx_NewRef(__pyx_empty_unicode);
23959 length = stop - start;
23962 return decode_func(cstring, length, errors);
23964 return PyUnicode_Decode(cstring, length, encoding, errors);
23969 static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
23970 __Pyx_PyThreadState_declare
23971 __Pyx_PyThreadState_assign
23972 if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
23974 __Pyx_PyErr_Clear();
23978 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *
n, PyObject *d) {
23979 PyObject *
r = __Pyx_GetAttr(o,
n);
23980 return (likely(
r)) ?
r : __Pyx_GetAttr3Default(d);
23984 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
23985 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
23986 PyObject *dict = Py_TYPE(obj)->tp_dict;
23987 return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
23989 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
23990 PyObject **dictptr = NULL;
23991 Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
23993 #if CYTHON_COMPILING_IN_CPYTHON
23994 dictptr = (likely(offset > 0)) ? (PyObject **) ((
char *)obj + offset) : _PyObject_GetDictPtr(obj);
23996 dictptr = _PyObject_GetDictPtr(obj);
23999 return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
24001 static CYTHON_INLINE
int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
24002 PyObject *dict = Py_TYPE(obj)->tp_dict;
24003 if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
24005 return obj_dict_version == __Pyx_get_object_dict_version(obj);
24010 #if CYTHON_USE_DICT_VERSIONS
24011 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
24013 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
24017 #if !CYTHON_AVOID_BORROWED_REFS
24018 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
24019 result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
24020 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
24021 if (likely(result)) {
24022 return __Pyx_NewRef(result);
24023 }
else if (unlikely(PyErr_Occurred())) {
24027 result = PyDict_GetItem(__pyx_d, name);
24028 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
24029 if (likely(result)) {
24030 return __Pyx_NewRef(result);
24034 result = PyObject_GetItem(__pyx_d, name);
24035 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
24036 if (likely(result)) {
24037 return __Pyx_NewRef(result);
24041 return __Pyx_GetBuiltinName(name);
24045 static CYTHON_INLINE
void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
24046 PyErr_Format(PyExc_ValueError,
24047 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T
"d)", expected);
24051 static CYTHON_INLINE
void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
24052 PyErr_Format(PyExc_ValueError,
24053 "need more than %" CYTHON_FORMAT_SSIZE_T
"d value%.1s to unpack",
24054 index, (index == 1) ?
"" :
"s");
24058 static CYTHON_INLINE
void __Pyx_RaiseNoneNotIterableError(
void) {
24059 PyErr_SetString(PyExc_TypeError,
"'NoneType' object is not iterable");
24063 #if CYTHON_FAST_THREAD_STATE
24064 static CYTHON_INLINE
void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
24065 PyObject *tmp_type, *tmp_value, *tmp_tb;
24066 #if CYTHON_USE_EXC_INFO_STACK
24067 _PyErr_StackItem *exc_info = tstate->exc_info;
24068 tmp_type = exc_info->exc_type;
24069 tmp_value = exc_info->exc_value;
24070 tmp_tb = exc_info->exc_traceback;
24071 exc_info->exc_type = *type;
24072 exc_info->exc_value = *value;
24073 exc_info->exc_traceback = *tb;
24075 tmp_type = tstate->exc_type;
24076 tmp_value = tstate->exc_value;
24077 tmp_tb = tstate->exc_traceback;
24078 tstate->exc_type = *type;
24079 tstate->exc_value = *value;
24080 tstate->exc_traceback = *tb;
24083 *value = tmp_value;
24087 static CYTHON_INLINE
void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
24088 PyObject *tmp_type, *tmp_value, *tmp_tb;
24089 PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
24090 PyErr_SetExcInfo(*type, *value, *tb);
24092 *value = tmp_value;
24098 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list,
int level) {
24099 PyObject *empty_list = 0;
24100 PyObject *module = 0;
24101 PyObject *global_dict = 0;
24102 PyObject *empty_dict = 0;
24104 #if PY_MAJOR_VERSION < 3
24105 PyObject *py_import;
24106 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
24113 empty_list = PyList_New(0);
24118 global_dict = PyModule_GetDict(__pyx_m);
24121 empty_dict = PyDict_New();
24125 #if PY_MAJOR_VERSION >= 3
24127 if ((1) && (strchr(__Pyx_MODULE_NAME,
'.'))) {
24128 module = PyImport_ImportModuleLevelObject(
24129 name, global_dict, empty_dict, list, 1);
24131 if (!PyErr_ExceptionMatches(PyExc_ImportError))
24140 #if PY_MAJOR_VERSION < 3
24141 PyObject *py_level = PyInt_FromLong(level);
24144 module = PyObject_CallFunctionObjArgs(py_import,
24145 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
24146 Py_DECREF(py_level);
24148 module = PyImport_ImportModuleLevelObject(
24149 name, global_dict, empty_dict, list, level);
24154 #if PY_MAJOR_VERSION < 3
24155 Py_XDECREF(py_import);
24157 Py_XDECREF(empty_list);
24158 Py_XDECREF(empty_dict);
24163 #if CYTHON_COMPILING_IN_CPYTHON
24164 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
24170 return b == &PyBaseObject_Type;
24172 static CYTHON_INLINE
int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
24174 if (a == b)
return 1;
24178 n = PyTuple_GET_SIZE(mro);
24179 for (i = 0; i <
n; i++) {
24180 if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
24185 return __Pyx_InBases(a, b);
24187 #if PY_MAJOR_VERSION == 2
24188 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
24189 PyObject *exception, *value, *tb;
24191 __Pyx_PyThreadState_declare
24192 __Pyx_PyThreadState_assign
24193 __Pyx_ErrFetch(&exception, &value, &tb);
24194 res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
24195 if (unlikely(res == -1)) {
24196 PyErr_WriteUnraisable(err);
24200 res = PyObject_IsSubclass(err, exc_type2);
24201 if (unlikely(res == -1)) {
24202 PyErr_WriteUnraisable(err);
24206 __Pyx_ErrRestore(exception, value, tb);
24210 static CYTHON_INLINE
int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
24211 int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
24213 res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
24218 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
24220 assert(PyExceptionClass_Check(exc_type));
24221 n = PyTuple_GET_SIZE(tuple);
24222 #if PY_MAJOR_VERSION >= 3
24223 for (i=0; i<
n; i++) {
24224 if (exc_type == PyTuple_GET_ITEM(tuple, i))
return 1;
24227 for (i=0; i<
n; i++) {
24228 PyObject *t = PyTuple_GET_ITEM(tuple, i);
24229 #if PY_MAJOR_VERSION < 3
24230 if (likely(exc_type == t))
return 1;
24232 if (likely(PyExceptionClass_Check(t))) {
24233 if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t))
return 1;
24239 static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
24240 if (likely(err == exc_type))
return 1;
24241 if (likely(PyExceptionClass_Check(err))) {
24242 if (likely(PyExceptionClass_Check(exc_type))) {
24243 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
24244 }
else if (likely(PyTuple_Check(exc_type))) {
24245 return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
24249 return PyErr_GivenExceptionMatches(err, exc_type);
24251 static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
24252 assert(PyExceptionClass_Check(exc_type1));
24253 assert(PyExceptionClass_Check(exc_type2));
24254 if (likely(err == exc_type1 || err == exc_type2))
return 1;
24255 if (likely(PyExceptionClass_Check(err))) {
24256 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
24258 return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
24263 static CYTHON_INLINE
void __Pyx_RaiseUnboundLocalError(
const char *varname) {
24264 PyErr_Format(PyExc_UnboundLocalError,
"local variable '%s' referenced before assignment", varname);
24268 static CYTHON_INLINE
long __Pyx_div_long(
long a,
long b) {
24271 q -= ((
r != 0) & ((
r ^ b) < 0));
24276 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
24277 PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
24278 if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
24279 PyErr_Format(PyExc_ImportError,
24280 #
if PY_MAJOR_VERSION < 3
24281 "cannot import name %.230s", PyString_AS_STRING(name));
24283 "cannot import name %S", name);
24290 static CYTHON_INLINE
int __Pyx_HasAttr(PyObject *o, PyObject *
n) {
24292 if (unlikely(!__Pyx_PyBaseString_Check(
n))) {
24293 PyErr_SetString(PyExc_TypeError,
24294 "hasattr(): attribute name must be string");
24297 r = __Pyx_GetAttr(o,
n);
24298 if (unlikely(!
r)) {
24308 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
24309 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
24310 PyErr_Format(PyExc_AttributeError,
24311 #
if PY_MAJOR_VERSION >= 3
24312 "'%.50s' object has no attribute '%U'",
24313 tp->tp_name, attr_name);
24315 "'%.50s' object has no attribute '%.400s'",
24316 tp->tp_name, PyString_AS_STRING(attr_name));
24320 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
24322 PyTypeObject *tp = Py_TYPE(obj);
24323 if (unlikely(!PyString_Check(attr_name))) {
24324 return PyObject_GenericGetAttr(obj, attr_name);
24326 assert(!tp->tp_dictoffset);
24327 descr = _PyType_Lookup(tp, attr_name);
24328 if (unlikely(!descr)) {
24329 return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
24332 #if PY_MAJOR_VERSION < 3
24333 if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
24336 descrgetfunc
f = Py_TYPE(descr)->tp_descr_get;
24338 PyObject *res =
f(descr, obj, (PyObject *)tp);
24348 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
24349 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
24350 if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
24351 return PyObject_GenericGetAttr(obj, attr_name);
24353 return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
24358 static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(
void) {
24359 __Pyx_PyThreadState_declare
24360 __Pyx_PyThreadState_assign
24361 if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
24362 __Pyx_PyErr_Clear();
24364 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
24366 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
24367 PyTypeObject* tp = Py_TYPE(obj);
24368 if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
24369 return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
24372 result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
24373 if (unlikely(!result)) {
24374 __Pyx_PyObject_GetAttrStr_ClearAttributeError();
24380 static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
24382 PyObject *name_attr;
24383 name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2);
24384 if (likely(name_attr)) {
24385 ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
24389 if (unlikely(ret < 0)) {
24393 Py_XDECREF(name_attr);
24396 static int __Pyx_setup_reduce(PyObject* type_obj) {
24398 PyObject *object_reduce = NULL;
24399 PyObject *object_reduce_ex = NULL;
24400 PyObject *reduce = NULL;
24401 PyObject *reduce_ex = NULL;
24402 PyObject *reduce_cython = NULL;
24403 PyObject *setstate = NULL;
24404 PyObject *setstate_cython = NULL;
24405 #if CYTHON_USE_PYTYPE_LOOKUP
24406 if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate))
goto __PYX_GOOD;
24408 if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate))
goto __PYX_GOOD;
24410 #if CYTHON_USE_PYTYPE_LOOKUP
24411 object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex);
if (!object_reduce_ex)
goto __PYX_BAD;
24413 object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex);
if (!object_reduce_ex)
goto __PYX_BAD;
24415 reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex);
if (unlikely(!reduce_ex))
goto __PYX_BAD;
24416 if (reduce_ex == object_reduce_ex) {
24417 #if CYTHON_USE_PYTYPE_LOOKUP
24418 object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce);
if (!object_reduce)
goto __PYX_BAD;
24420 object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce);
if (!object_reduce)
goto __PYX_BAD;
24422 reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce);
if (unlikely(!reduce))
goto __PYX_BAD;
24423 if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
24424 reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
24425 if (likely(reduce_cython)) {
24426 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython);
if (unlikely(ret < 0))
goto __PYX_BAD;
24427 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython);
if (unlikely(ret < 0))
goto __PYX_BAD;
24428 }
else if (reduce == object_reduce || PyErr_Occurred()) {
24431 setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
24432 if (!setstate) PyErr_Clear();
24433 if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
24434 setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
24435 if (likely(setstate_cython)) {
24436 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython);
if (unlikely(ret < 0))
goto __PYX_BAD;
24437 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython);
if (unlikely(ret < 0))
goto __PYX_BAD;
24438 }
else if (!setstate || PyErr_Occurred()) {
24442 PyType_Modified((PyTypeObject*)type_obj);
24447 if (!PyErr_Occurred())
24448 PyErr_Format(PyExc_RuntimeError,
"Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
24451 #if !CYTHON_USE_PYTYPE_LOOKUP
24452 Py_XDECREF(object_reduce);
24453 Py_XDECREF(object_reduce_ex);
24455 Py_XDECREF(reduce);
24456 Py_XDECREF(reduce_ex);
24457 Py_XDECREF(reduce_cython);
24458 Py_XDECREF(setstate);
24459 Py_XDECREF(setstate_cython);
24464 static int __Pyx_SetVtable(PyObject *dict,
void *vtable) {
24465 #if PY_VERSION_HEX >= 0x02070000
24466 PyObject *ob = PyCapsule_New(vtable, 0, 0);
24468 PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
24472 if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
24482 #ifndef __PYX_HAVE_RT_ImportType
24483 #define __PYX_HAVE_RT_ImportType
24484 static PyTypeObject *__Pyx_ImportType(PyObject *module,
const char *module_name,
const char *class_name,
24485 size_t size,
enum __Pyx_ImportType_CheckSize check_size)
24487 PyObject *result = 0;
24489 Py_ssize_t basicsize;
24490 #ifdef Py_LIMITED_API
24491 PyObject *py_basicsize;
24493 result = PyObject_GetAttrString(module, class_name);
24496 if (!PyType_Check(result)) {
24497 PyErr_Format(PyExc_TypeError,
24498 "%.200s.%.200s is not a type object",
24499 module_name, class_name);
24502 #ifndef Py_LIMITED_API
24503 basicsize = ((PyTypeObject *)result)->tp_basicsize;
24505 py_basicsize = PyObject_GetAttrString(result,
"__basicsize__");
24508 basicsize = PyLong_AsSsize_t(py_basicsize);
24509 Py_DECREF(py_basicsize);
24511 if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
24514 if ((
size_t)basicsize < size) {
24515 PyErr_Format(PyExc_ValueError,
24516 "%.200s.%.200s size changed, may indicate binary incompatibility. "
24517 "Expected %zd from C header, got %zd from PyObject",
24518 module_name, class_name, size, basicsize);
24521 if (check_size == __Pyx_ImportType_CheckSize_Error && (
size_t)basicsize != size) {
24522 PyErr_Format(PyExc_ValueError,
24523 "%.200s.%.200s size changed, may indicate binary incompatibility. "
24524 "Expected %zd from C header, got %zd from PyObject",
24525 module_name, class_name, size, basicsize);
24528 else if (check_size == __Pyx_ImportType_CheckSize_Warn && (
size_t)basicsize > size) {
24529 PyOS_snprintf(warning,
sizeof(warning),
24530 "%s.%s size changed, may indicate binary incompatibility. "
24531 "Expected %zd from C header, got %zd from PyObject",
24532 module_name, class_name, size, basicsize);
24533 if (PyErr_WarnEx(NULL, warning, 0) < 0)
goto bad;
24535 return (PyTypeObject *)result;
24537 Py_XDECREF(result);
24543 static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
24544 Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
24545 for (i=0; i < nbases; i++) {
24546 PyTypeObject *tmptype;
24547 PyObject *tmp = PyTuple_GET_ITEM(bases, i);
24548 tmptype = Py_TYPE(tmp);
24549 #if PY_MAJOR_VERSION < 3
24550 if (tmptype == &PyClass_Type)
24554 metaclass = tmptype;
24557 if (PyType_IsSubtype(metaclass, tmptype))
24559 if (PyType_IsSubtype(tmptype, metaclass)) {
24560 metaclass = tmptype;
24563 PyErr_SetString(PyExc_TypeError,
24564 "metaclass conflict: "
24565 "the metaclass of a derived class "
24566 "must be a (non-strict) subclass "
24567 "of the metaclasses of all its bases");
24571 #if PY_MAJOR_VERSION < 3
24572 metaclass = &PyClass_Type;
24574 metaclass = &PyType_Type;
24577 Py_INCREF((PyObject*) metaclass);
24578 return (PyObject*) metaclass;
24582 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
24583 PyObject* fake_module;
24584 PyTypeObject* cached_type = NULL;
24585 fake_module = PyImport_AddModule((
char*)
"_cython_" CYTHON_ABI);
24586 if (!fake_module)
return NULL;
24587 Py_INCREF(fake_module);
24588 cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
24590 if (!PyType_Check((PyObject*)cached_type)) {
24591 PyErr_Format(PyExc_TypeError,
24592 "Shared Cython type %.200s is not a type object",
24596 if (cached_type->tp_basicsize != type->tp_basicsize) {
24597 PyErr_Format(PyExc_TypeError,
24598 "Shared Cython type %.200s has the wrong size, try recompiling",
24603 if (!PyErr_ExceptionMatches(PyExc_AttributeError))
goto bad;
24605 if (PyType_Ready(type) < 0)
goto bad;
24606 if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
24609 cached_type = type;
24612 Py_DECREF(fake_module);
24613 return cached_type;
24615 Py_XDECREF(cached_type);
24616 cached_type = NULL;
24621 #include <structmember.h>
24623 __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *closure)
24625 if (unlikely(op->func_doc == NULL)) {
24626 if (op->func.m_ml->ml_doc) {
24627 #if PY_MAJOR_VERSION >= 3
24628 op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
24630 op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
24632 if (unlikely(op->func_doc == NULL))
24635 Py_INCREF(Py_None);
24639 Py_INCREF(op->func_doc);
24640 return op->func_doc;
24643 __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED
void *context)
24645 PyObject *tmp = op->func_doc;
24646 if (value == NULL) {
24650 op->func_doc = value;
24655 __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
24657 if (unlikely(op->func_name == NULL)) {
24658 #if PY_MAJOR_VERSION >= 3
24659 op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
24661 op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
24663 if (unlikely(op->func_name == NULL))
24666 Py_INCREF(op->func_name);
24667 return op->func_name;
24670 __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED
void *context)
24673 #if PY_MAJOR_VERSION >= 3
24674 if (unlikely(value == NULL || !PyUnicode_Check(value)))
24676 if (unlikely(value == NULL || !PyString_Check(value)))
24679 PyErr_SetString(PyExc_TypeError,
24680 "__name__ must be set to a string object");
24683 tmp = op->func_name;
24685 op->func_name = value;
24690 __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
24692 Py_INCREF(op->func_qualname);
24693 return op->func_qualname;
24696 __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED
void *context)
24699 #if PY_MAJOR_VERSION >= 3
24700 if (unlikely(value == NULL || !PyUnicode_Check(value)))
24702 if (unlikely(value == NULL || !PyString_Check(value)))
24705 PyErr_SetString(PyExc_TypeError,
24706 "__qualname__ must be set to a string object");
24709 tmp = op->func_qualname;
24711 op->func_qualname = value;
24716 __Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED
void *closure)
24719 self = m->func_closure;
24726 __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
24728 if (unlikely(op->func_dict == NULL)) {
24729 op->func_dict = PyDict_New();
24730 if (unlikely(op->func_dict == NULL))
24733 Py_INCREF(op->func_dict);
24734 return op->func_dict;
24737 __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED
void *context)
24740 if (unlikely(value == NULL)) {
24741 PyErr_SetString(PyExc_TypeError,
24742 "function's dictionary may not be deleted");
24745 if (unlikely(!PyDict_Check(value))) {
24746 PyErr_SetString(PyExc_TypeError,
24747 "setting function's dictionary to a non-dict");
24750 tmp = op->func_dict;
24752 op->func_dict = value;
24757 __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
24759 Py_INCREF(op->func_globals);
24760 return op->func_globals;
24763 __Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
24765 Py_INCREF(Py_None);
24769 __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
24771 PyObject* result = (op->func_code) ? op->func_code : Py_None;
24776 __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
24778 PyObject *res = op->defaults_getter((PyObject *) op);
24779 if (unlikely(!res))
24781 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
24782 op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
24783 Py_INCREF(op->defaults_tuple);
24784 op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
24785 Py_INCREF(op->defaults_kwdict);
24787 op->defaults_tuple = PySequence_ITEM(res, 0);
24788 if (unlikely(!op->defaults_tuple)) result = -1;
24790 op->defaults_kwdict = PySequence_ITEM(res, 1);
24791 if (unlikely(!op->defaults_kwdict)) result = -1;
24798 __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED
void *context) {
24802 }
else if (value != Py_None && !PyTuple_Check(value)) {
24803 PyErr_SetString(PyExc_TypeError,
24804 "__defaults__ must be set to a tuple object");
24808 tmp = op->defaults_tuple;
24809 op->defaults_tuple = value;
24814 __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context) {
24815 PyObject* result = op->defaults_tuple;
24816 if (unlikely(!result)) {
24817 if (op->defaults_getter) {
24818 if (__Pyx_CyFunction_init_defaults(op) < 0)
return NULL;
24819 result = op->defaults_tuple;
24828 __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED
void *context) {
24832 }
else if (value != Py_None && !PyDict_Check(value)) {
24833 PyErr_SetString(PyExc_TypeError,
24834 "__kwdefaults__ must be set to a dict object");
24838 tmp = op->defaults_kwdict;
24839 op->defaults_kwdict = value;
24844 __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context) {
24845 PyObject* result = op->defaults_kwdict;
24846 if (unlikely(!result)) {
24847 if (op->defaults_getter) {
24848 if (__Pyx_CyFunction_init_defaults(op) < 0)
return NULL;
24849 result = op->defaults_kwdict;
24858 __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED
void *context) {
24860 if (!value || value == Py_None) {
24862 }
else if (!PyDict_Check(value)) {
24863 PyErr_SetString(PyExc_TypeError,
24864 "__annotations__ must be set to a dict object");
24868 tmp = op->func_annotations;
24869 op->func_annotations = value;
24874 __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context) {
24875 PyObject* result = op->func_annotations;
24876 if (unlikely(!result)) {
24877 result = PyDict_New();
24878 if (unlikely(!result))
return NULL;
24879 op->func_annotations = result;
24884 static PyGetSetDef __pyx_CyFunction_getsets[] = {
24885 {(
char *)
"func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
24886 {(
char *)
"__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
24887 {(
char *)
"func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
24888 {(
char *)
"__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
24889 {(
char *)
"__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
24890 {(
char *)
"__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
24891 {(
char *)
"func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
24892 {(
char *)
"__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
24893 {(
char *)
"func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
24894 {(
char *)
"__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
24895 {(
char *)
"func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
24896 {(
char *)
"__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
24897 {(
char *)
"func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
24898 {(
char *)
"__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
24899 {(
char *)
"func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
24900 {(
char *)
"__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
24901 {(
char *)
"__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
24902 {(
char *)
"__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
24905 static PyMemberDef __pyx_CyFunction_members[] = {
24906 {(
char *)
"__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0},
24910 __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
24912 #if PY_MAJOR_VERSION >= 3
24913 Py_INCREF(m->func_qualname);
24914 return m->func_qualname;
24916 return PyString_FromString(m->func.m_ml->ml_name);
24919 static PyMethodDef __pyx_CyFunction_methods[] = {
24920 {
"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
24923 #if PY_VERSION_HEX < 0x030500A0
24924 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
24926 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
24928 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml,
int flags, PyObject* qualname,
24929 PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
24930 if (unlikely(op == NULL))
24933 __Pyx_CyFunction_weakreflist(op) = NULL;
24934 op->func.m_ml = ml;
24935 op->func.m_self = (PyObject *) op;
24936 Py_XINCREF(closure);
24937 op->func_closure = closure;
24938 Py_XINCREF(module);
24939 op->func.m_module = module;
24940 op->func_dict = NULL;
24941 op->func_name = NULL;
24942 Py_INCREF(qualname);
24943 op->func_qualname = qualname;
24944 op->func_doc = NULL;
24945 op->func_classobj = NULL;
24946 op->func_globals = globals;
24947 Py_INCREF(op->func_globals);
24949 op->func_code = code;
24950 op->defaults_pyobjects = 0;
24951 op->defaults_size = 0;
24952 op->defaults = NULL;
24953 op->defaults_tuple = NULL;
24954 op->defaults_kwdict = NULL;
24955 op->defaults_getter = NULL;
24956 op->func_annotations = NULL;
24957 return (PyObject *) op;
24960 __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
24962 Py_CLEAR(m->func_closure);
24963 Py_CLEAR(m->func.m_module);
24964 Py_CLEAR(m->func_dict);
24965 Py_CLEAR(m->func_name);
24966 Py_CLEAR(m->func_qualname);
24967 Py_CLEAR(m->func_doc);
24968 Py_CLEAR(m->func_globals);
24969 Py_CLEAR(m->func_code);
24970 Py_CLEAR(m->func_classobj);
24971 Py_CLEAR(m->defaults_tuple);
24972 Py_CLEAR(m->defaults_kwdict);
24973 Py_CLEAR(m->func_annotations);
24975 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
24977 for (i = 0; i < m->defaults_pyobjects; i++)
24978 Py_XDECREF(pydefaults[i]);
24979 PyObject_Free(m->defaults);
24980 m->defaults = NULL;
24984 static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
24986 if (__Pyx_CyFunction_weakreflist(m) != NULL)
24987 PyObject_ClearWeakRefs((PyObject *) m);
24988 __Pyx_CyFunction_clear(m);
24989 PyObject_GC_Del(m);
24991 static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
24993 PyObject_GC_UnTrack(m);
24994 __Pyx__CyFunction_dealloc(m);
24996 static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit,
void *arg)
24998 Py_VISIT(m->func_closure);
24999 Py_VISIT(m->func.m_module);
25000 Py_VISIT(m->func_dict);
25001 Py_VISIT(m->func_name);
25002 Py_VISIT(m->func_qualname);
25003 Py_VISIT(m->func_doc);
25004 Py_VISIT(m->func_globals);
25005 Py_VISIT(m->func_code);
25006 Py_VISIT(m->func_classobj);
25007 Py_VISIT(m->defaults_tuple);
25008 Py_VISIT(m->defaults_kwdict);
25010 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
25012 for (i = 0; i < m->defaults_pyobjects; i++)
25013 Py_VISIT(pydefaults[i]);
25017 static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
25019 #if PY_MAJOR_VERSION < 3
25020 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
25021 if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
25025 if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
25027 type = (PyObject *)(Py_TYPE(obj));
25028 return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
25030 if (obj == Py_None)
25033 return __Pyx_PyMethod_New(func, obj, type);
25036 __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
25038 #if PY_MAJOR_VERSION >= 3
25039 return PyUnicode_FromFormat(
"<cyfunction %U at %p>",
25040 op->func_qualname, (
void *)op);
25042 return PyString_FromFormat(
"<cyfunction %s at %p>",
25043 PyString_AsString(op->func_qualname), (
void *)op);
25046 static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *
self, PyObject *arg, PyObject *kw) {
25047 PyCFunctionObject*
f = (PyCFunctionObject*)func;
25048 PyCFunction meth =
f->m_ml->ml_meth;
25050 switch (
f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
25052 if (likely(kw == NULL || PyDict_Size(kw) == 0))
25053 return (*meth)(
self, arg);
25055 case METH_VARARGS | METH_KEYWORDS:
25056 return (*(PyCFunctionWithKeywords)(
void*)meth)(
self, arg, kw);
25058 if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
25059 size = PyTuple_GET_SIZE(arg);
25060 if (likely(size == 0))
25061 return (*meth)(
self, NULL);
25062 PyErr_Format(PyExc_TypeError,
25063 "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T
"d given)",
25064 f->m_ml->ml_name, size);
25069 if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
25070 size = PyTuple_GET_SIZE(arg);
25071 if (likely(size == 1)) {
25072 PyObject *result, *arg0;
25073 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
25074 arg0 = PyTuple_GET_ITEM(arg, 0);
25076 arg0 = PySequence_ITEM(arg, 0);
if (unlikely(!arg0))
return NULL;
25078 result = (*meth)(
self, arg0);
25079 #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
25084 PyErr_Format(PyExc_TypeError,
25085 "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T
"d given)",
25086 f->m_ml->ml_name, size);
25091 PyErr_SetString(PyExc_SystemError,
"Bad call flags in "
25092 "__Pyx_CyFunction_Call. METH_OLDARGS is no "
25093 "longer supported!");
25096 PyErr_Format(PyExc_TypeError,
"%.200s() takes no keyword arguments",
25100 static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
25101 return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
25103 static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
25105 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
25106 if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
25108 PyObject *new_args;
25110 argc = PyTuple_GET_SIZE(args);
25111 new_args = PyTuple_GetSlice(args, 1, argc);
25112 if (unlikely(!new_args))
25114 self = PyTuple_GetItem(args, 0);
25115 if (unlikely(!
self)) {
25116 Py_DECREF(new_args);
25119 result = __Pyx_CyFunction_CallMethod(func,
self, new_args, kw);
25120 Py_DECREF(new_args);
25122 result = __Pyx_CyFunction_Call(func, args, kw);
25126 static PyTypeObject __pyx_CyFunctionType_type = {
25127 PyVarObject_HEAD_INIT(0, 0)
25128 "cython_function_or_method",
25129 sizeof(__pyx_CyFunctionObject),
25131 (destructor) __Pyx_CyFunction_dealloc,
25135 #if PY_MAJOR_VERSION < 3
25140 (reprfunc) __Pyx_CyFunction_repr,
25145 __Pyx_CyFunction_CallAsMethod,
25150 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
25152 (traverseproc) __Pyx_CyFunction_traverse,
25153 (inquiry) __Pyx_CyFunction_clear,
25155 #
if PY_VERSION_HEX < 0x030500A0
25156 offsetof(__pyx_CyFunctionObject, func_weakreflist),
25158 offsetof(PyCFunctionObject, m_weakreflist),
25162 __pyx_CyFunction_methods,
25163 __pyx_CyFunction_members,
25164 __pyx_CyFunction_getsets,
25167 __Pyx_CyFunction_descr_get,
25169 offsetof(__pyx_CyFunctionObject, func_dict),
25182 #if PY_VERSION_HEX >= 0x030400a1
25185 #if PY_VERSION_HEX >= 0x030800b1
25188 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
25192 static int __pyx_CyFunction_init(
void) {
25193 __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
25194 if (unlikely(__pyx_CyFunctionType == NULL)) {
25199 static CYTHON_INLINE
void *__Pyx_CyFunction_InitDefaults(PyObject *func,
size_t size,
int pyobjects) {
25200 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
25201 m->defaults = PyObject_Malloc(size);
25202 if (unlikely(!m->defaults))
25203 return PyErr_NoMemory();
25204 memset(m->defaults, 0, size);
25205 m->defaults_pyobjects = pyobjects;
25206 m->defaults_size = size;
25207 return m->defaults;
25209 static CYTHON_INLINE
void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
25210 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
25211 m->defaults_tuple = tuple;
25214 static CYTHON_INLINE
void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
25215 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
25216 m->defaults_kwdict = dict;
25219 static CYTHON_INLINE
void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
25220 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
25221 m->func_annotations = dict;
25226 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
int flags, PyObject* qualname,
25227 PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
25228 PyObject *op = __Pyx_CyFunction_Init(
25229 PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType),
25230 ml, flags, qualname, closure, module, globals, code
25233 PyObject_GC_Track(op);
25239 static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
25240 PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
25243 PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
25245 PyObject *pargs = PyTuple_Pack(2, name, bases);
25246 if (unlikely(!pargs)) {
25250 ns = PyObject_Call(prep, pargs, mkw);
25254 if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
25264 if (unlikely(PyObject_SetItem(
ns, __pyx_n_s_module, modname) < 0))
goto bad;
25265 if (unlikely(PyObject_SetItem(
ns, __pyx_n_s_qualname, qualname) < 0))
goto bad;
25266 if (unlikely(doc && PyObject_SetItem(
ns, __pyx_n_s_doc, doc) < 0))
goto bad;
25272 static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
25273 PyObject *dict, PyObject *mkw,
25274 int calculate_metaclass,
int allow_py2_metaclass) {
25275 PyObject *result, *margs;
25276 PyObject *owned_metaclass = NULL;
25277 if (allow_py2_metaclass) {
25278 owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
25279 if (owned_metaclass) {
25280 metaclass = owned_metaclass;
25281 }
else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
25287 if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
25288 metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
25289 Py_XDECREF(owned_metaclass);
25290 if (unlikely(!metaclass))
25292 owned_metaclass = metaclass;
25294 margs = PyTuple_Pack(3, name, bases, dict);
25295 if (unlikely(!margs)) {
25298 result = PyObject_Call(metaclass, margs, mkw);
25301 Py_XDECREF(owned_metaclass);
25306 #ifndef CYTHON_CLINE_IN_TRACEBACK
25307 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate,
int c_line) {
25308 PyObject *use_cline;
25309 PyObject *ptype, *pvalue, *ptraceback;
25310 #if CYTHON_COMPILING_IN_CPYTHON
25311 PyObject **cython_runtime_dict;
25313 if (unlikely(!__pyx_cython_runtime)) {
25316 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
25317 #if CYTHON_COMPILING_IN_CPYTHON
25318 cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
25319 if (likely(cython_runtime_dict)) {
25320 __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
25321 use_cline, *cython_runtime_dict,
25322 __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
25326 PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
25327 if (use_cline_obj) {
25328 use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
25329 Py_DECREF(use_cline_obj);
25337 PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
25339 else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
25342 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
25348 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries,
int count,
int code_line) {
25349 int start = 0, mid = 0, end = count - 1;
25350 if (end >= 0 && code_line > entries[end].code_line) {
25353 while (start < end) {
25354 mid = start + (end - start) / 2;
25355 if (code_line < entries[mid].code_line) {
25357 }
else if (code_line > entries[mid].code_line) {
25363 if (code_line <= entries[mid].code_line) {
25369 static PyCodeObject *__pyx_find_code_object(
int code_line) {
25370 PyCodeObject* code_object;
25372 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
25375 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
25376 if (unlikely(
pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[
pos].code_line != code_line)) {
25379 code_object = __pyx_code_cache.entries[
pos].code_object;
25380 Py_INCREF(code_object);
25381 return code_object;
25383 static void __pyx_insert_code_object(
int code_line, PyCodeObject* code_object) {
25385 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
25386 if (unlikely(!code_line)) {
25389 if (unlikely(!entries)) {
25390 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*
sizeof(__Pyx_CodeObjectCacheEntry));
25391 if (likely(entries)) {
25392 __pyx_code_cache.entries = entries;
25393 __pyx_code_cache.max_count = 64;
25394 __pyx_code_cache.count = 1;
25395 entries[0].code_line = code_line;
25396 entries[0].code_object = code_object;
25397 Py_INCREF(code_object);
25401 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
25402 if ((
pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[
pos].code_line == code_line)) {
25403 PyCodeObject* tmp = entries[
pos].code_object;
25404 entries[
pos].code_object = code_object;
25408 if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
25409 int new_max = __pyx_code_cache.max_count + 64;
25410 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
25411 __pyx_code_cache.entries, ((
size_t)new_max) *
sizeof(__Pyx_CodeObjectCacheEntry));
25412 if (unlikely(!entries)) {
25415 __pyx_code_cache.entries = entries;
25416 __pyx_code_cache.max_count = new_max;
25418 for (i=__pyx_code_cache.count; i>
pos; i--) {
25419 entries[i] = entries[i-1];
25421 entries[
pos].code_line = code_line;
25422 entries[
pos].code_object = code_object;
25423 __pyx_code_cache.count++;
25424 Py_INCREF(code_object);
25428 #include "compile.h"
25429 #include "frameobject.h"
25430 #include "traceback.h"
25431 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
25432 const char *funcname,
int c_line,
25433 int py_line,
const char *filename) {
25434 PyCodeObject *py_code = 0;
25435 PyObject *py_srcfile = 0;
25436 PyObject *py_funcname = 0;
25437 #if PY_MAJOR_VERSION < 3
25438 py_srcfile = PyString_FromString(filename);
25440 py_srcfile = PyUnicode_FromString(filename);
25442 if (!py_srcfile)
goto bad;
25444 #if PY_MAJOR_VERSION < 3
25445 py_funcname = PyString_FromFormat(
"%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
25447 py_funcname = PyUnicode_FromFormat(
"%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
25451 #if PY_MAJOR_VERSION < 3
25452 py_funcname = PyString_FromString(funcname);
25454 py_funcname = PyUnicode_FromString(funcname);
25457 if (!py_funcname)
goto bad;
25458 py_code = __Pyx_PyCode_New(
25475 Py_DECREF(py_srcfile);
25476 Py_DECREF(py_funcname);
25479 Py_XDECREF(py_srcfile);
25480 Py_XDECREF(py_funcname);
25483 static void __Pyx_AddTraceback(
const char *funcname,
int c_line,
25484 int py_line,
const char *filename) {
25485 PyCodeObject *py_code = 0;
25486 PyFrameObject *py_frame = 0;
25487 PyThreadState *tstate = __Pyx_PyThreadState_Current;
25489 c_line = __Pyx_CLineForTraceback(tstate, c_line);
25491 py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
25493 py_code = __Pyx_CreateCodeObjectForTraceback(
25494 funcname, c_line, py_line, filename);
25495 if (!py_code)
goto bad;
25496 __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
25498 py_frame = PyFrame_New(
25504 if (!py_frame)
goto bad;
25505 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
25506 PyTraceBack_Here(py_frame);
25508 Py_XDECREF(py_code);
25509 Py_XDECREF(py_frame);
25512 #if PY_MAJOR_VERSION < 3
25513 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view,
int flags) {
25514 if (PyObject_CheckBuffer(obj))
return PyObject_GetBuffer(obj, view, flags);
25515 if (__Pyx_TypeCheck(obj, __pyx_array_type))
return __pyx_array_getbuffer(obj, view, flags);
25516 if (__Pyx_TypeCheck(obj, __pyx_memoryview_type))
return __pyx_memoryview_getbuffer(obj, view, flags);
25517 PyErr_Format(PyExc_TypeError,
"'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
25520 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
25521 PyObject *obj = view->obj;
25523 if (PyObject_CheckBuffer(obj)) {
25524 PyBuffer_Release(view);
25536 __pyx_memviewslice_is_contig(
const __Pyx_memviewslice mvs,
char order,
int ndim)
25538 int i, index, step, start;
25539 Py_ssize_t itemsize = mvs.memview->view.itemsize;
25540 if (order ==
'F') {
25547 for (i = 0; i < ndim; i++) {
25548 index = start + step * i;
25549 if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize)
25551 itemsize *= mvs.shape[index];
25558 __pyx_get_array_memory_extents(__Pyx_memviewslice *slice,
25559 void **out_start,
void **out_end,
25560 int ndim,
size_t itemsize)
25564 start = end = slice->data;
25565 for (i = 0; i < ndim; i++) {
25566 Py_ssize_t stride = slice->strides[i];
25567 Py_ssize_t extent = slice->shape[i];
25569 *out_start = *out_end = start;
25573 end += stride * (extent - 1);
25575 start += stride * (extent - 1);
25578 *out_start = start;
25579 *out_end = end + itemsize;
25582 __pyx_slices_overlap(__Pyx_memviewslice *slice1,
25583 __Pyx_memviewslice *slice2,
25584 int ndim,
size_t itemsize)
25586 void *start1, *end1, *start2, *end2;
25587 __pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize);
25588 __pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize);
25589 return (start1 < end2) && (start2 < end1);
25593 static CYTHON_INLINE PyObject *
25594 __pyx_capsule_create(
void *p, CYTHON_UNUSED
const char *sig)
25597 #if PY_VERSION_HEX >= 0x02070000
25598 cobj = PyCapsule_New(p, sig, NULL);
25600 cobj = PyCObject_FromVoidPtr(p, NULL);
25606 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
25607 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
25608 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
25609 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
25610 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
25612 func_type value = func_value;\
25613 if (sizeof(target_type) < sizeof(func_type)) {\
25614 if (unlikely(value != (func_type) (target_type) value)) {\
25615 func_type zero = 0;\
25616 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
25617 return (target_type) -1;\
25618 if (is_unsigned && unlikely(value < zero))\
25619 goto raise_neg_overflow;\
25621 goto raise_overflow;\
25624 return (target_type) value;\
25628 static CYTHON_INLINE
int __Pyx_Is_Little_Endian(
void)
25634 S.u32 = 0x01020304;
25635 return S.u8[0] == 4;
25639 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
25640 __Pyx_BufFmt_StackElem* stack,
25641 __Pyx_TypeInfo* type) {
25642 stack[0].field = &ctx->root;
25643 stack[0].parent_offset = 0;
25644 ctx->root.type = type;
25645 ctx->root.name =
"buffer dtype";
25646 ctx->root.offset = 0;
25648 ctx->head->field = &ctx->root;
25649 ctx->fmt_offset = 0;
25650 ctx->head->parent_offset = 0;
25651 ctx->new_packmode =
'@';
25652 ctx->enc_packmode =
'@';
25653 ctx->new_count = 1;
25654 ctx->enc_count = 0;
25656 ctx->is_complex = 0;
25657 ctx->is_valid_array = 0;
25658 ctx->struct_alignment = 0;
25659 while (type->typegroup ==
'S') {
25661 ctx->head->field = type->fields;
25662 ctx->head->parent_offset = 0;
25663 type = type->fields->type;
25666 static int __Pyx_BufFmt_ParseNumber(
const char** ts) {
25668 const char* t = *ts;
25669 if (*t < '0' || *t >
'9') {
25672 count = *t++ -
'0';
25673 while (*t >=
'0' && *t <=
'9') {
25675 count += *t++ -
'0';
25681 static int __Pyx_BufFmt_ExpectNumber(
const char **ts) {
25682 int number = __Pyx_BufFmt_ParseNumber(ts);
25684 PyErr_Format(PyExc_ValueError,\
25685 "Does not understand character buffer dtype format string ('%c')", **ts);
25688 static void __Pyx_BufFmt_RaiseUnexpectedChar(
char ch) {
25689 PyErr_Format(PyExc_ValueError,
25690 "Unexpected format string character: '%c'", ch);
25692 static const char* __Pyx_BufFmt_DescribeTypeChar(
char ch,
int is_complex) {
25694 case '?':
return "'bool'";
25695 case 'c':
return "'char'";
25696 case 'b':
return "'signed char'";
25697 case 'B':
return "'unsigned char'";
25698 case 'h':
return "'short'";
25699 case 'H':
return "'unsigned short'";
25700 case 'i':
return "'int'";
25701 case 'I':
return "'unsigned int'";
25702 case 'l':
return "'long'";
25703 case 'L':
return "'unsigned long'";
25704 case 'q':
return "'long long'";
25705 case 'Q':
return "'unsigned long long'";
25706 case 'f':
return (is_complex ?
"'complex float'" :
"'float'");
25707 case 'd':
return (is_complex ?
"'complex double'" :
"'double'");
25708 case 'g':
return (is_complex ?
"'complex long double'" :
"'long double'");
25709 case 'T':
return "a struct";
25710 case 'O':
return "Python object";
25711 case 'P':
return "a pointer";
25712 case 's':
case 'p':
return "a string";
25713 case 0:
return "end";
25714 default:
return "unparseable format string";
25717 static size_t __Pyx_BufFmt_TypeCharToStandardSize(
char ch,
int is_complex) {
25719 case '?':
case 'c':
case 'b':
case 'B':
case 's':
case 'p':
return 1;
25720 case 'h':
case 'H':
return 2;
25721 case 'i':
case 'I':
case 'l':
case 'L':
return 4;
25722 case 'q':
case 'Q':
return 8;
25723 case 'f':
return (is_complex ? 8 : 4);
25724 case 'd':
return (is_complex ? 16 : 8);
25726 PyErr_SetString(PyExc_ValueError,
"Python does not define a standard format string size for long double ('g')..");
25729 case 'O':
case 'P':
return sizeof(
void*);
25731 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
25735 static size_t __Pyx_BufFmt_TypeCharToNativeSize(
char ch,
int is_complex) {
25737 case '?':
case 'c':
case 'b':
case 'B':
case 's':
case 'p':
return 1;
25738 case 'h':
case 'H':
return sizeof(short);
25739 case 'i':
case 'I':
return sizeof(int);
25740 case 'l':
case 'L':
return sizeof(long);
25741 #ifdef HAVE_LONG_LONG
25742 case 'q':
case 'Q':
return sizeof(PY_LONG_LONG);
25744 case 'f':
return sizeof(float) * (is_complex ? 2 : 1);
25745 case 'd':
return sizeof(double) * (is_complex ? 2 : 1);
25746 case 'g':
return sizeof(
long double) * (is_complex ? 2 : 1);
25747 case 'O':
case 'P':
return sizeof(
void*);
25749 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
25754 typedef struct {
char c;
short x; } __Pyx_st_short;
25755 typedef struct {
char c;
int x; } __Pyx_st_int;
25756 typedef struct {
char c;
long x; } __Pyx_st_long;
25757 typedef struct {
char c;
float x; } __Pyx_st_float;
25758 typedef struct {
char c;
double x; } __Pyx_st_double;
25759 typedef struct {
char c;
long double x; } __Pyx_st_longdouble;
25760 typedef struct {
char c;
void *x; } __Pyx_st_void_p;
25761 #ifdef HAVE_LONG_LONG
25762 typedef struct {
char c; PY_LONG_LONG x; } __Pyx_st_longlong;
25764 static size_t __Pyx_BufFmt_TypeCharToAlignment(
char ch, CYTHON_UNUSED
int is_complex) {
25766 case '?':
case 'c':
case 'b':
case 'B':
case 's':
case 'p':
return 1;
25767 case 'h':
case 'H':
return sizeof(__Pyx_st_short) -
sizeof(
short);
25768 case 'i':
case 'I':
return sizeof(__Pyx_st_int) -
sizeof(
int);
25769 case 'l':
case 'L':
return sizeof(__Pyx_st_long) -
sizeof(
long);
25770 #ifdef HAVE_LONG_LONG
25771 case 'q':
case 'Q':
return sizeof(__Pyx_st_longlong) -
sizeof(PY_LONG_LONG);
25773 case 'f':
return sizeof(__Pyx_st_float) -
sizeof(
float);
25774 case 'd':
return sizeof(__Pyx_st_double) -
sizeof(
double);
25775 case 'g':
return sizeof(__Pyx_st_longdouble) -
sizeof(
long double);
25776 case 'P':
case 'O':
return sizeof(__Pyx_st_void_p) -
sizeof(
void*);
25778 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
25786 typedef struct {
short x;
char c; } __Pyx_pad_short;
25787 typedef struct {
int x;
char c; } __Pyx_pad_int;
25788 typedef struct {
long x;
char c; } __Pyx_pad_long;
25789 typedef struct {
float x;
char c; } __Pyx_pad_float;
25790 typedef struct {
double x;
char c; } __Pyx_pad_double;
25791 typedef struct {
long double x;
char c; } __Pyx_pad_longdouble;
25792 typedef struct {
void *x;
char c; } __Pyx_pad_void_p;
25793 #ifdef HAVE_LONG_LONG
25794 typedef struct { PY_LONG_LONG x;
char c; } __Pyx_pad_longlong;
25796 static size_t __Pyx_BufFmt_TypeCharToPadding(
char ch, CYTHON_UNUSED
int is_complex) {
25798 case '?':
case 'c':
case 'b':
case 'B':
case 's':
case 'p':
return 1;
25799 case 'h':
case 'H':
return sizeof(__Pyx_pad_short) -
sizeof(
short);
25800 case 'i':
case 'I':
return sizeof(__Pyx_pad_int) -
sizeof(
int);
25801 case 'l':
case 'L':
return sizeof(__Pyx_pad_long) -
sizeof(
long);
25802 #ifdef HAVE_LONG_LONG
25803 case 'q':
case 'Q':
return sizeof(__Pyx_pad_longlong) -
sizeof(PY_LONG_LONG);
25805 case 'f':
return sizeof(__Pyx_pad_float) -
sizeof(
float);
25806 case 'd':
return sizeof(__Pyx_pad_double) -
sizeof(
double);
25807 case 'g':
return sizeof(__Pyx_pad_longdouble) -
sizeof(
long double);
25808 case 'P':
case 'O':
return sizeof(__Pyx_pad_void_p) -
sizeof(
void*);
25810 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
25814 static char __Pyx_BufFmt_TypeCharToGroup(
char ch,
int is_complex) {
25818 case 'b':
case 'h':
case 'i':
25819 case 'l':
case 'q':
case 's':
case 'p':
25821 case '?':
case 'B':
case 'H':
case 'I':
case 'L':
case 'Q':
25823 case 'f':
case 'd':
case 'g':
25824 return (is_complex ?
'C' :
'R');
25830 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
25835 static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
25836 if (ctx->head == NULL || ctx->head->field == &ctx->root) {
25837 const char* expected;
25839 if (ctx->head == NULL) {
25843 expected = ctx->head->field->type->name;
25846 PyErr_Format(PyExc_ValueError,
25847 "Buffer dtype mismatch, expected %s%s%s but got %s",
25848 quote, expected, quote,
25849 __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
25851 __Pyx_StructField* field = ctx->head->field;
25852 __Pyx_StructField* parent = (ctx->head - 1)->field;
25853 PyErr_Format(PyExc_ValueError,
25854 "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
25855 field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
25856 parent->type->name, field->name);
25859 static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
25861 size_t size, offset, arraysize = 1;
25862 if (ctx->enc_type == 0)
return 0;
25863 if (ctx->head->field->type->arraysize[0]) {
25865 if (ctx->enc_type ==
's' || ctx->enc_type ==
'p') {
25866 ctx->is_valid_array = ctx->head->field->type->ndim == 1;
25868 if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
25869 PyErr_Format(PyExc_ValueError,
25870 "Expected a dimension of size %zu, got %zu",
25871 ctx->head->field->type->arraysize[0], ctx->enc_count);
25875 if (!ctx->is_valid_array) {
25876 PyErr_Format(PyExc_ValueError,
"Expected %d dimensions, got %d",
25877 ctx->head->field->type->ndim, ndim);
25880 for (i = 0; i < ctx->head->field->type->ndim; i++) {
25881 arraysize *= ctx->head->field->type->arraysize[i];
25883 ctx->is_valid_array = 0;
25884 ctx->enc_count = 1;
25886 group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
25888 __Pyx_StructField* field = ctx->head->field;
25889 __Pyx_TypeInfo* type = field->type;
25890 if (ctx->enc_packmode ==
'@' || ctx->enc_packmode ==
'^') {
25891 size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
25893 size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
25895 if (ctx->enc_packmode ==
'@') {
25896 size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
25897 size_t align_mod_offset;
25898 if (align_at == 0)
return -1;
25899 align_mod_offset = ctx->fmt_offset % align_at;
25900 if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
25901 if (ctx->struct_alignment == 0)
25902 ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
25905 if (type->size != size || type->typegroup != group) {
25906 if (type->typegroup ==
'C' && type->fields != NULL) {
25907 size_t parent_offset = ctx->head->parent_offset + field->offset;
25909 ctx->head->field = type->fields;
25910 ctx->head->parent_offset = parent_offset;
25913 if ((type->typegroup ==
'H' || group ==
'H') && type->size == size) {
25915 __Pyx_BufFmt_RaiseExpected(ctx);
25919 offset = ctx->head->parent_offset + field->offset;
25920 if (ctx->fmt_offset != offset) {
25921 PyErr_Format(PyExc_ValueError,
25922 "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T
"d but %" CYTHON_FORMAT_SSIZE_T
"d expected",
25923 (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
25926 ctx->fmt_offset += size;
25928 ctx->fmt_offset += (arraysize - 1) * size;
25931 if (field == &ctx->root) {
25933 if (ctx->enc_count != 0) {
25934 __Pyx_BufFmt_RaiseExpected(ctx);
25939 ctx->head->field = ++field;
25940 if (field->type == NULL) {
25942 field = ctx->head->field;
25944 }
else if (field->type->typegroup ==
'S') {
25945 size_t parent_offset = ctx->head->parent_offset + field->offset;
25946 if (field->type->fields->type == NULL)
continue;
25947 field = field->type->fields;
25949 ctx->head->field = field;
25950 ctx->head->parent_offset = parent_offset;
25956 }
while (ctx->enc_count);
25958 ctx->is_complex = 0;
25962 __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx,
const char** tsp)
25964 const char *ts = *tsp;
25965 int i = 0,
number, ndim;
25967 if (ctx->new_count != 1) {
25968 PyErr_SetString(PyExc_ValueError,
25969 "Cannot handle repeated arrays in format string");
25972 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
25973 ndim = ctx->head->field->type->ndim;
25974 while (*ts && *ts !=
')') {
25976 case ' ':
case '\f':
case '\r':
case '\n':
case '\t':
case '\v':
continue;
25979 number = __Pyx_BufFmt_ExpectNumber(&ts);
25980 if (
number == -1)
return NULL;
25981 if (i < ndim && (
size_t)
number != ctx->head->field->type->arraysize[i])
25982 return PyErr_Format(PyExc_ValueError,
25983 "Expected a dimension of size %zu, got %d",
25984 ctx->head->field->type->arraysize[i],
number);
25985 if (*ts !=
',' && *ts !=
')')
25986 return PyErr_Format(PyExc_ValueError,
25987 "Expected a comma in format string, got '%c'", *ts);
25988 if (*ts ==
',') ts++;
25992 return PyErr_Format(PyExc_ValueError,
"Expected %d dimension(s), got %d",
25993 ctx->head->field->type->ndim, i);
25995 PyErr_SetString(PyExc_ValueError,
25996 "Unexpected end of format string, expected ')'");
25999 ctx->is_valid_array = 1;
26000 ctx->new_count = 1;
26004 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx,
const char* ts) {
26009 if (ctx->enc_type != 0 && ctx->head == NULL) {
26010 __Pyx_BufFmt_RaiseExpected(ctx);
26013 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
26014 if (ctx->head != NULL) {
26015 __Pyx_BufFmt_RaiseExpected(ctx);
26025 if (!__Pyx_Is_Little_Endian()) {
26026 PyErr_SetString(PyExc_ValueError,
"Little-endian buffer not supported on big-endian compiler");
26029 ctx->new_packmode =
'=';
26034 if (__Pyx_Is_Little_Endian()) {
26035 PyErr_SetString(PyExc_ValueError,
"Big-endian buffer not supported on little-endian compiler");
26038 ctx->new_packmode =
'=';
26044 ctx->new_packmode = *ts++;
26048 const char* ts_after_sub;
26049 size_t i, struct_count = ctx->new_count;
26050 size_t struct_alignment = ctx->struct_alignment;
26051 ctx->new_count = 1;
26054 PyErr_SetString(PyExc_ValueError,
"Buffer acquisition: Expected '{' after 'T'");
26057 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
26059 ctx->enc_count = 0;
26060 ctx->struct_alignment = 0;
26063 for (i = 0; i != struct_count; ++i) {
26064 ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
26065 if (!ts_after_sub)
return NULL;
26068 if (struct_alignment) ctx->struct_alignment = struct_alignment;
26073 size_t alignment = ctx->struct_alignment;
26075 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
26077 if (alignment && ctx->fmt_offset % alignment) {
26078 ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
26083 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
26084 ctx->fmt_offset += ctx->new_count;
26085 ctx->new_count = 1;
26086 ctx->enc_count = 0;
26088 ctx->enc_packmode = ctx->new_packmode;
26094 if (*ts !=
'f' && *ts !=
'd' && *ts !=
'g') {
26095 __Pyx_BufFmt_RaiseUnexpectedChar(
'Z');
26098 CYTHON_FALLTHROUGH;
26099 case '?':
case 'c':
case 'b':
case 'B':
case 'h':
case 'H':
case 'i':
case 'I':
26100 case 'l':
case 'L':
case 'q':
case 'Q':
26101 case 'f':
case 'd':
case 'g':
26102 case 'O':
case 'p':
26103 if ((ctx->enc_type == *ts) && (got_Z == ctx->is_complex) &&
26104 (ctx->enc_packmode == ctx->new_packmode) && (!ctx->is_valid_array)) {
26105 ctx->enc_count += ctx->new_count;
26106 ctx->new_count = 1;
26111 CYTHON_FALLTHROUGH;
26113 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
26114 ctx->enc_count = ctx->new_count;
26115 ctx->enc_packmode = ctx->new_packmode;
26116 ctx->enc_type = *ts;
26117 ctx->is_complex = got_Z;
26119 ctx->new_count = 1;
26124 while(*ts !=
':') ++ts;
26128 if (!__pyx_buffmt_parse_array(ctx, &ts))
return NULL;
26132 int number = __Pyx_BufFmt_ExpectNumber(&ts);
26133 if (
number == -1)
return NULL;
26134 ctx->new_count = (size_t)
number;
26142 __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
26149 if (a->size != b->size || a->typegroup != b->typegroup ||
26150 a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
26151 if (a->typegroup ==
'H' || b->typegroup ==
'H') {
26152 return a->size == b->size;
26158 for (i = 0; i < a->ndim; i++)
26159 if (a->arraysize[i] != b->arraysize[i])
26162 if (a->typegroup ==
'S') {
26163 if (a->flags != b->flags)
26165 if (a->fields || b->fields) {
26166 if (!(a->fields && b->fields))
26168 for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
26169 __Pyx_StructField *field_a = a->fields + i;
26170 __Pyx_StructField *field_b = b->fields + i;
26171 if (field_a->offset != field_b->offset ||
26172 !__pyx_typeinfo_cmp(field_a->type, field_b->type))
26175 return !a->fields[i].type && !b->fields[i].type;
26183 __pyx_check_strides(Py_buffer *buf,
int dim,
int ndim,
int spec)
26185 if (buf->shape[dim] <= 1)
26187 if (buf->strides) {
26188 if (spec & __Pyx_MEMVIEW_CONTIG) {
26189 if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
26190 if (unlikely(buf->strides[dim] !=
sizeof(
void *))) {
26191 PyErr_Format(PyExc_ValueError,
26192 "Buffer is not indirectly contiguous "
26193 "in dimension %d.", dim);
26196 }
else if (unlikely(buf->strides[dim] != buf->itemsize)) {
26197 PyErr_SetString(PyExc_ValueError,
26198 "Buffer and memoryview are not contiguous "
26199 "in the same dimension.");
26203 if (spec & __Pyx_MEMVIEW_FOLLOW) {
26204 Py_ssize_t stride = buf->strides[dim];
26207 if (unlikely(stride < buf->itemsize)) {
26208 PyErr_SetString(PyExc_ValueError,
26209 "Buffer and memoryview are not contiguous "
26210 "in the same dimension.");
26215 if (unlikely(spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1)) {
26216 PyErr_Format(PyExc_ValueError,
26217 "C-contiguous buffer is not contiguous in "
26218 "dimension %d", dim);
26220 }
else if (unlikely(spec & (__Pyx_MEMVIEW_PTR))) {
26221 PyErr_Format(PyExc_ValueError,
26222 "C-contiguous buffer is not indirect in "
26223 "dimension %d", dim);
26225 }
else if (unlikely(buf->suboffsets)) {
26226 PyErr_SetString(PyExc_ValueError,
26227 "Buffer exposes suboffsets but no strides");
26236 __pyx_check_suboffsets(Py_buffer *buf,
int dim, CYTHON_UNUSED
int ndim,
int spec)
26238 if (spec & __Pyx_MEMVIEW_DIRECT) {
26239 if (unlikely(buf->suboffsets && buf->suboffsets[dim] >= 0)) {
26240 PyErr_Format(PyExc_ValueError,
26241 "Buffer not compatible with direct access "
26242 "in dimension %d.", dim);
26246 if (spec & __Pyx_MEMVIEW_PTR) {
26247 if (unlikely(!buf->suboffsets || (buf->suboffsets[dim] < 0))) {
26248 PyErr_Format(PyExc_ValueError,
26249 "Buffer is not indirectly accessible "
26250 "in dimension %d.", dim);
26259 __pyx_verify_contig(Py_buffer *buf,
int ndim,
int c_or_f_flag)
26262 if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
26263 Py_ssize_t stride = 1;
26264 for (i = 0; i < ndim; i++) {
26265 if (unlikely(stride * buf->itemsize != buf->strides[i] && buf->shape[i] > 1)) {
26266 PyErr_SetString(PyExc_ValueError,
26267 "Buffer not fortran contiguous.");
26270 stride = stride * buf->shape[i];
26272 }
else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
26273 Py_ssize_t stride = 1;
26274 for (i = ndim - 1; i >- 1; i--) {
26275 if (unlikely(stride * buf->itemsize != buf->strides[i] && buf->shape[i] > 1)) {
26276 PyErr_SetString(PyExc_ValueError,
26277 "Buffer not C contiguous.");
26280 stride = stride * buf->shape[i];
26287 static int __Pyx_ValidateAndInit_memviewslice(
26292 __Pyx_TypeInfo *dtype,
26293 __Pyx_BufFmt_StackElem stack[],
26294 __Pyx_memviewslice *memviewslice,
26295 PyObject *original_obj)
26297 struct __pyx_memoryview_obj *memview, *new_memview;
26298 __Pyx_RefNannyDeclarations
26300 int i, spec = 0, retval = -1;
26301 __Pyx_BufFmt_Context ctx;
26302 int from_memoryview = __pyx_memoryview_check(original_obj);
26303 __Pyx_RefNannySetupContext(
"ValidateAndInit_memviewslice", 0);
26304 if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((
struct __pyx_memoryview_obj *)
26305 original_obj)->typeinfo)) {
26306 memview = (
struct __pyx_memoryview_obj *) original_obj;
26307 new_memview = NULL;
26309 memview = (
struct __pyx_memoryview_obj *) __pyx_memoryview_new(
26310 original_obj, buf_flags, 0, dtype);
26311 new_memview = memview;
26312 if (unlikely(!memview))
26315 buf = &memview->view;
26316 if (unlikely(buf->ndim != ndim)) {
26317 PyErr_Format(PyExc_ValueError,
26318 "Buffer has wrong number of dimensions (expected %d, got %d)",
26323 __Pyx_BufFmt_Init(&ctx, stack, dtype);
26324 if (unlikely(!__Pyx_BufFmt_CheckString(&ctx, buf->format)))
goto fail;
26326 if (unlikely((
unsigned) buf->itemsize != dtype->size)) {
26327 PyErr_Format(PyExc_ValueError,
26328 "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T
"u byte%s) "
26329 "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T
"u byte%s)",
26331 (buf->itemsize > 1) ?
"s" :
"",
26334 (dtype->size > 1) ?
"s" :
"");
26337 if (buf->len > 0) {
26338 for (i = 0; i < ndim; i++) {
26339 spec = axes_specs[i];
26340 if (unlikely(!__pyx_check_strides(buf, i, ndim, spec)))
26342 if (unlikely(!__pyx_check_suboffsets(buf, i, ndim, spec)))
26345 if (unlikely(buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag)))
26348 if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
26349 new_memview != NULL) == -1)) {
26355 Py_XDECREF(new_memview);
26358 __Pyx_RefNannyFinishContext();
26363 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(PyObject *obj,
int writable_flag) {
26364 __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
26365 __Pyx_BufFmt_StackElem stack[1];
26366 int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
26368 if (obj == Py_None) {
26369 result.memview = (
struct __pyx_memoryview_obj *) Py_None;
26372 retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
26373 PyBUF_RECORDS_RO | writable_flag, 1,
26374 &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, stack,
26376 if (unlikely(retcode == -1))
26380 result.memview = NULL;
26381 result.data = NULL;
26386 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int32_t(PyObject *obj,
int writable_flag) {
26387 __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
26388 __Pyx_BufFmt_StackElem stack[1];
26389 int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
26391 if (obj == Py_None) {
26392 result.memview = (
struct __pyx_memoryview_obj *) Py_None;
26395 retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
26396 PyBUF_RECORDS_RO | writable_flag, 1,
26397 &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, stack,
26399 if (unlikely(retcode == -1))
26403 result.memview = NULL;
26404 result.data = NULL;
26409 #if CYTHON_CCOMPLEX
26411 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(
float x,
float y) {
26412 return ::std::complex< float >(x, y);
26415 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(
float x,
float y) {
26416 return x + y*(__pyx_t_float_complex)_Complex_I;
26420 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(
float x,
float y) {
26421 __pyx_t_float_complex
z;
26429 #if CYTHON_CCOMPLEX
26431 static CYTHON_INLINE
int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
26432 return (a.real == b.real) && (a.imag == b.imag);
26434 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
26435 __pyx_t_float_complex
z;
26436 z.real = a.real + b.real;
26437 z.imag = a.imag + b.imag;
26440 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
26441 __pyx_t_float_complex
z;
26442 z.real = a.real - b.real;
26443 z.imag = a.imag - b.imag;
26446 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
26447 __pyx_t_float_complex
z;
26448 z.real = a.real * b.real - a.imag * b.imag;
26449 z.imag = a.real * b.imag + a.imag * b.real;
26453 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
26455 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
26456 }
else if (fabsf(b.real) >= fabsf(b.imag)) {
26457 if (b.real == 0 && b.imag == 0) {
26458 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
26460 float r = b.imag / b.real;
26461 float s = (float)(1.0) / (b.real + b.imag *
r);
26462 return __pyx_t_float_complex_from_parts(
26463 (a.real + a.imag *
r) *
s, (a.imag - a.real *
r) *
s);
26466 float r = b.real / b.imag;
26467 float s = (float)(1.0) / (b.imag + b.real *
r);
26468 return __pyx_t_float_complex_from_parts(
26469 (a.real *
r + a.imag) *
s, (a.imag *
r - a.real) *
s);
26473 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
26475 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
26477 float denom = b.real * b.real + b.imag * b.imag;
26478 return __pyx_t_float_complex_from_parts(
26479 (a.real * b.real + a.imag * b.imag) / denom,
26480 (a.imag * b.real - a.real * b.imag) / denom);
26484 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
26485 __pyx_t_float_complex
z;
26490 static CYTHON_INLINE
int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
26491 return (a.real == 0) && (a.imag == 0);
26493 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
26494 __pyx_t_float_complex
z;
26500 static CYTHON_INLINE
float __Pyx_c_abs_float(__pyx_t_float_complex
z) {
26501 #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
26502 return sqrtf(
z.real*
z.real +
z.imag*
z.imag);
26504 return hypotf(
z.real,
z.imag);
26507 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
26508 __pyx_t_float_complex
z;
26509 float r, lnr, theta, z_r, z_theta;
26510 if (b.imag == 0 && b.real == (
int)b.real) {
26512 float denom = a.real * a.real + a.imag * a.imag;
26513 a.real = a.real / denom;
26514 a.imag = -a.imag / denom;
26517 switch ((
int)b.real) {
26525 return __Pyx_c_prod_float(a, a);
26527 z = __Pyx_c_prod_float(a, a);
26528 return __Pyx_c_prod_float(
z, a);
26530 z = __Pyx_c_prod_float(a, a);
26531 return __Pyx_c_prod_float(
z,
z);
26537 }
else if (b.imag == 0) {
26538 z.real = powf(a.real, b.real);
26541 }
else if (a.real > 0) {
26546 theta = atan2f(0.0, -1.0);
26549 r = __Pyx_c_abs_float(a);
26550 theta = atan2f(a.imag, a.real);
26553 z_r = expf(lnr * b.real - theta * b.imag);
26554 z_theta = theta * b.real + lnr * b.imag;
26555 z.real = z_r * cosf(z_theta);
26556 z.imag = z_r * sinf(z_theta);
26563 #if CYTHON_CCOMPLEX
26565 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(
double x,
double y) {
26566 return ::std::complex< double >(x, y);
26569 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(
double x,
double y) {
26570 return x + y*(__pyx_t_double_complex)_Complex_I;
26574 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(
double x,
double y) {
26575 __pyx_t_double_complex
z;
26583 #if CYTHON_CCOMPLEX
26585 static CYTHON_INLINE
int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
26586 return (a.real == b.real) && (a.imag == b.imag);
26588 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
26589 __pyx_t_double_complex
z;
26590 z.real = a.real + b.real;
26591 z.imag = a.imag + b.imag;
26594 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
26595 __pyx_t_double_complex
z;
26596 z.real = a.real - b.real;
26597 z.imag = a.imag - b.imag;
26600 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
26601 __pyx_t_double_complex
z;
26602 z.real = a.real * b.real - a.imag * b.imag;
26603 z.imag = a.real * b.imag + a.imag * b.real;
26607 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
26609 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
26610 }
else if (fabs(b.real) >= fabs(b.imag)) {
26611 if (b.real == 0 && b.imag == 0) {
26612 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
26614 double r = b.imag / b.real;
26615 double s = (double)(1.0) / (b.real + b.imag *
r);
26616 return __pyx_t_double_complex_from_parts(
26617 (a.real + a.imag *
r) *
s, (a.imag - a.real *
r) *
s);
26620 double r = b.real / b.imag;
26621 double s = (double)(1.0) / (b.imag + b.real *
r);
26622 return __pyx_t_double_complex_from_parts(
26623 (a.real *
r + a.imag) *
s, (a.imag *
r - a.real) *
s);
26627 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
26629 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
26631 double denom = b.real * b.real + b.imag * b.imag;
26632 return __pyx_t_double_complex_from_parts(
26633 (a.real * b.real + a.imag * b.imag) / denom,
26634 (a.imag * b.real - a.real * b.imag) / denom);
26638 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
26639 __pyx_t_double_complex
z;
26644 static CYTHON_INLINE
int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
26645 return (a.real == 0) && (a.imag == 0);
26647 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
26648 __pyx_t_double_complex
z;
26654 static CYTHON_INLINE
double __Pyx_c_abs_double(__pyx_t_double_complex
z) {
26655 #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
26656 return sqrt(
z.real*
z.real +
z.imag*
z.imag);
26658 return hypot(
z.real,
z.imag);
26661 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
26662 __pyx_t_double_complex
z;
26663 double r, lnr, theta, z_r, z_theta;
26664 if (b.imag == 0 && b.real == (
int)b.real) {
26666 double denom = a.real * a.real + a.imag * a.imag;
26667 a.real = a.real / denom;
26668 a.imag = -a.imag / denom;
26671 switch ((
int)b.real) {
26679 return __Pyx_c_prod_double(a, a);
26681 z = __Pyx_c_prod_double(a, a);
26682 return __Pyx_c_prod_double(
z, a);
26684 z = __Pyx_c_prod_double(a, a);
26685 return __Pyx_c_prod_double(
z,
z);
26691 }
else if (b.imag == 0) {
26692 z.real = pow(a.real, b.real);
26695 }
else if (a.real > 0) {
26700 theta = atan2(0.0, -1.0);
26703 r = __Pyx_c_abs_double(a);
26704 theta = atan2(a.imag, a.real);
26707 z_r = exp(lnr * b.real - theta * b.imag);
26708 z_theta = theta * b.real + lnr * b.imag;
26709 z.real = z_r * cos(z_theta);
26710 z.imag = z_r * sin(z_theta);
26717 static __Pyx_memviewslice
26718 __pyx_memoryview_copy_new_contig(
const __Pyx_memviewslice *from_mvs,
26719 const char *mode,
int ndim,
26720 size_t sizeof_dtype,
int contig_flag,
26721 int dtype_is_object)
26723 __Pyx_RefNannyDeclarations
26725 __Pyx_memviewslice new_mvs = { 0, 0, { 0 }, { 0 }, { 0 } };
26726 struct __pyx_memoryview_obj *from_memview = from_mvs->memview;
26727 Py_buffer *buf = &from_memview->view;
26728 PyObject *shape_tuple = NULL;
26729 PyObject *temp_int = NULL;
26730 struct __pyx_array_obj *array_obj = NULL;
26731 struct __pyx_memoryview_obj *memview_obj = NULL;
26732 __Pyx_RefNannySetupContext(
"__pyx_memoryview_copy_new_contig", 0);
26733 for (i = 0; i < ndim; i++) {
26734 if (unlikely(from_mvs->suboffsets[i] >= 0)) {
26735 PyErr_Format(PyExc_ValueError,
"Cannot copy memoryview slice with "
26736 "indirect dimensions (axis %d)", i);
26740 shape_tuple = PyTuple_New(ndim);
26741 if (unlikely(!shape_tuple)) {
26744 __Pyx_GOTREF(shape_tuple);
26745 for(i = 0; i < ndim; i++) {
26746 temp_int = PyInt_FromSsize_t(from_mvs->shape[i]);
26747 if(unlikely(!temp_int)) {
26750 PyTuple_SET_ITEM(shape_tuple, i, temp_int);
26754 array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, (
char *) mode, NULL);
26755 if (unlikely(!array_obj)) {
26758 __Pyx_GOTREF(array_obj);
26759 memview_obj = (
struct __pyx_memoryview_obj *) __pyx_memoryview_new(
26760 (PyObject *) array_obj, contig_flag,
26762 from_mvs->memview->typeinfo);
26763 if (unlikely(!memview_obj))
26765 if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0))
26767 if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim,
26768 dtype_is_object) < 0))
26772 __Pyx_XDECREF(new_mvs.memview);
26773 new_mvs.memview = NULL;
26774 new_mvs.data = NULL;
26776 __Pyx_XDECREF(shape_tuple);
26777 __Pyx_XDECREF(temp_int);
26778 __Pyx_XDECREF(array_obj);
26779 __Pyx_RefNannyFinishContext();
26784 static CYTHON_INLINE
int __Pyx_PyInt_As_int(PyObject *x) {
26785 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26786 #pragma GCC diagnostic push
26787 #pragma GCC diagnostic ignored "-Wconversion"
26789 const int neg_one = (int) -1, const_zero = (
int) 0;
26790 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26791 #pragma GCC diagnostic pop
26793 const int is_unsigned = neg_one > const_zero;
26794 #if PY_MAJOR_VERSION < 3
26795 if (likely(PyInt_Check(x))) {
26796 if (
sizeof(
int) <
sizeof(long)) {
26797 __PYX_VERIFY_RETURN_INT(
int,
long, PyInt_AS_LONG(x))
26799 long val = PyInt_AS_LONG(x);
26800 if (is_unsigned && unlikely(val < 0)) {
26801 goto raise_neg_overflow;
26807 if (likely(PyLong_Check(x))) {
26809 #if CYTHON_USE_PYLONG_INTERNALS
26810 const digit* digits = ((PyLongObject*)x)->ob_digit;
26811 switch (Py_SIZE(x)) {
26812 case 0:
return (
int) 0;
26813 case 1: __PYX_VERIFY_RETURN_INT(
int, digit, digits[0])
26815 if (8 *
sizeof(
int) > 1 * PyLong_SHIFT) {
26816 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
26817 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
26818 }
else if (8 *
sizeof(
int) >= 2 * PyLong_SHIFT) {
26819 return (
int) (((((int)digits[1]) << PyLong_SHIFT) | (
int)digits[0]));
26824 if (8 *
sizeof(
int) > 2 * PyLong_SHIFT) {
26825 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
26826 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
26827 }
else if (8 *
sizeof(
int) >= 3 * PyLong_SHIFT) {
26828 return (
int) (((((((int)digits[2]) << PyLong_SHIFT) | (
int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
26833 if (8 *
sizeof(
int) > 3 * PyLong_SHIFT) {
26834 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
26835 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
26836 }
else if (8 *
sizeof(
int) >= 4 * PyLong_SHIFT) {
26837 return (
int) (((((((((int)digits[3]) << PyLong_SHIFT) | (
int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (
int)digits[0]));
26843 #if CYTHON_COMPILING_IN_CPYTHON
26844 if (unlikely(Py_SIZE(x) < 0)) {
26845 goto raise_neg_overflow;
26849 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
26850 if (unlikely(result < 0))
26852 if (unlikely(result == 1))
26853 goto raise_neg_overflow;
26856 if (
sizeof(
int) <=
sizeof(
unsigned long)) {
26857 __PYX_VERIFY_RETURN_INT_EXC(
int,
unsigned long, PyLong_AsUnsignedLong(x))
26858 #ifdef HAVE_LONG_LONG
26859 }
else if (
sizeof(
int) <=
sizeof(
unsigned PY_LONG_LONG)) {
26860 __PYX_VERIFY_RETURN_INT_EXC(
int,
unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
26864 #if CYTHON_USE_PYLONG_INTERNALS
26865 const digit* digits = ((PyLongObject*)x)->ob_digit;
26866 switch (Py_SIZE(x)) {
26867 case 0:
return (
int) 0;
26868 case -1: __PYX_VERIFY_RETURN_INT(
int, sdigit, (sdigit) (-(sdigit)digits[0]))
26869 case 1: __PYX_VERIFY_RETURN_INT(
int, digit, +digits[0])
26871 if (8 *
sizeof(
int) - 1 > 1 * PyLong_SHIFT) {
26872 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
26873 __PYX_VERIFY_RETURN_INT(
int,
long, -(
long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
26874 }
else if (8 *
sizeof(
int) - 1 > 2 * PyLong_SHIFT) {
26875 return (
int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
26880 if (8 *
sizeof(
int) > 1 * PyLong_SHIFT) {
26881 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
26882 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
26883 }
else if (8 *
sizeof(
int) - 1 > 2 * PyLong_SHIFT) {
26884 return (
int) ((((((int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
26889 if (8 *
sizeof(
int) - 1 > 2 * PyLong_SHIFT) {
26890 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
26891 __PYX_VERIFY_RETURN_INT(
int,
long, -(
long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
26892 }
else if (8 *
sizeof(
int) - 1 > 3 * PyLong_SHIFT) {
26893 return (
int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (
int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
26898 if (8 *
sizeof(
int) > 2 * PyLong_SHIFT) {
26899 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
26900 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
26901 }
else if (8 *
sizeof(
int) - 1 > 3 * PyLong_SHIFT) {
26902 return (
int) ((((((((int)digits[2]) << PyLong_SHIFT) | (
int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
26907 if (8 *
sizeof(
int) - 1 > 3 * PyLong_SHIFT) {
26908 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
26909 __PYX_VERIFY_RETURN_INT(
int,
long, -(
long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
26910 }
else if (8 *
sizeof(
int) - 1 > 4 * PyLong_SHIFT) {
26911 return (
int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (
int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
26916 if (8 *
sizeof(
int) > 3 * PyLong_SHIFT) {
26917 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
26918 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
26919 }
else if (8 *
sizeof(
int) - 1 > 4 * PyLong_SHIFT) {
26920 return (
int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (
int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
26926 if (
sizeof(
int) <=
sizeof(long)) {
26927 __PYX_VERIFY_RETURN_INT_EXC(
int,
long, PyLong_AsLong(x))
26928 #ifdef HAVE_LONG_LONG
26929 }
else if (
sizeof(
int) <=
sizeof(PY_LONG_LONG)) {
26930 __PYX_VERIFY_RETURN_INT_EXC(
int, PY_LONG_LONG, PyLong_AsLongLong(x))
26935 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
26936 PyErr_SetString(PyExc_RuntimeError,
26937 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
26940 PyObject *
v = __Pyx_PyNumber_IntOrLong(x);
26941 #if PY_MAJOR_VERSION < 3
26942 if (likely(
v) && !PyLong_Check(
v)) {
26944 v = PyNumber_Long(tmp);
26949 int one = 1;
int is_little = (int)*(
unsigned char *)&one;
26950 unsigned char *bytes = (
unsigned char *)&val;
26951 int ret = _PyLong_AsByteArray((PyLongObject *)
v,
26952 bytes,
sizeof(val),
26953 is_little, !is_unsigned);
26963 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
26964 if (!tmp)
return (
int) -1;
26965 val = __Pyx_PyInt_As_int(tmp);
26970 PyErr_SetString(PyExc_OverflowError,
26971 "value too large to convert to int");
26973 raise_neg_overflow:
26974 PyErr_SetString(PyExc_OverflowError,
26975 "can't convert negative value to int");
26980 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_int32(npy_int32 value) {
26981 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26982 #pragma GCC diagnostic push
26983 #pragma GCC diagnostic ignored "-Wconversion"
26985 const npy_int32 neg_one = (npy_int32) -1, const_zero = (npy_int32) 0;
26986 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26987 #pragma GCC diagnostic pop
26989 const int is_unsigned = neg_one > const_zero;
26991 if (
sizeof(npy_int32) <
sizeof(long)) {
26992 return PyInt_FromLong((
long) value);
26993 }
else if (
sizeof(npy_int32) <=
sizeof(
unsigned long)) {
26994 return PyLong_FromUnsignedLong((
unsigned long) value);
26995 #ifdef HAVE_LONG_LONG
26996 }
else if (
sizeof(npy_int32) <=
sizeof(
unsigned PY_LONG_LONG)) {
26997 return PyLong_FromUnsignedLongLong((
unsigned PY_LONG_LONG) value);
27001 if (
sizeof(npy_int32) <=
sizeof(
long)) {
27002 return PyInt_FromLong((
long) value);
27003 #ifdef HAVE_LONG_LONG
27004 }
else if (
sizeof(npy_int32) <=
sizeof(PY_LONG_LONG)) {
27005 return PyLong_FromLongLong((PY_LONG_LONG) value);
27010 int one = 1;
int little = (int)*(
unsigned char *)&one;
27011 unsigned char *bytes = (
unsigned char *)&value;
27012 return _PyLong_FromByteArray(bytes,
sizeof(npy_int32),
27013 little, !is_unsigned);
27018 static CYTHON_INLINE npy_int32 __Pyx_PyInt_As_npy_int32(PyObject *x) {
27019 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27020 #pragma GCC diagnostic push
27021 #pragma GCC diagnostic ignored "-Wconversion"
27023 const npy_int32 neg_one = (npy_int32) -1, const_zero = (npy_int32) 0;
27024 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27025 #pragma GCC diagnostic pop
27027 const int is_unsigned = neg_one > const_zero;
27028 #if PY_MAJOR_VERSION < 3
27029 if (likely(PyInt_Check(x))) {
27030 if (
sizeof(npy_int32) <
sizeof(long)) {
27031 __PYX_VERIFY_RETURN_INT(npy_int32,
long, PyInt_AS_LONG(x))
27033 long val = PyInt_AS_LONG(x);
27034 if (is_unsigned && unlikely(val < 0)) {
27035 goto raise_neg_overflow;
27037 return (npy_int32) val;
27041 if (likely(PyLong_Check(x))) {
27043 #if CYTHON_USE_PYLONG_INTERNALS
27044 const digit* digits = ((PyLongObject*)x)->ob_digit;
27045 switch (Py_SIZE(x)) {
27046 case 0:
return (npy_int32) 0;
27047 case 1: __PYX_VERIFY_RETURN_INT(npy_int32, digit, digits[0])
27049 if (8 *
sizeof(npy_int32) > 1 * PyLong_SHIFT) {
27050 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
27051 __PYX_VERIFY_RETURN_INT(npy_int32,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27052 }
else if (8 *
sizeof(npy_int32) >= 2 * PyLong_SHIFT) {
27053 return (npy_int32) (((((npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0]));
27058 if (8 *
sizeof(npy_int32) > 2 * PyLong_SHIFT) {
27059 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
27060 __PYX_VERIFY_RETURN_INT(npy_int32,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27061 }
else if (8 *
sizeof(npy_int32) >= 3 * PyLong_SHIFT) {
27062 return (npy_int32) (((((((npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0]));
27067 if (8 *
sizeof(npy_int32) > 3 * PyLong_SHIFT) {
27068 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
27069 __PYX_VERIFY_RETURN_INT(npy_int32,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27070 }
else if (8 *
sizeof(npy_int32) >= 4 * PyLong_SHIFT) {
27071 return (npy_int32) (((((((((npy_int32)digits[3]) << PyLong_SHIFT) | (npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0]));
27077 #if CYTHON_COMPILING_IN_CPYTHON
27078 if (unlikely(Py_SIZE(x) < 0)) {
27079 goto raise_neg_overflow;
27083 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
27084 if (unlikely(result < 0))
27085 return (npy_int32) -1;
27086 if (unlikely(result == 1))
27087 goto raise_neg_overflow;
27090 if (
sizeof(npy_int32) <=
sizeof(
unsigned long)) {
27091 __PYX_VERIFY_RETURN_INT_EXC(npy_int32,
unsigned long, PyLong_AsUnsignedLong(x))
27092 #ifdef HAVE_LONG_LONG
27093 }
else if (
sizeof(npy_int32) <=
sizeof(
unsigned PY_LONG_LONG)) {
27094 __PYX_VERIFY_RETURN_INT_EXC(npy_int32,
unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
27098 #if CYTHON_USE_PYLONG_INTERNALS
27099 const digit* digits = ((PyLongObject*)x)->ob_digit;
27100 switch (Py_SIZE(x)) {
27101 case 0:
return (npy_int32) 0;
27102 case -1: __PYX_VERIFY_RETURN_INT(npy_int32, sdigit, (sdigit) (-(sdigit)digits[0]))
27103 case 1: __PYX_VERIFY_RETURN_INT(npy_int32, digit, +digits[0])
27105 if (8 *
sizeof(npy_int32) - 1 > 1 * PyLong_SHIFT) {
27106 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
27107 __PYX_VERIFY_RETURN_INT(npy_int32,
long, -(
long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27108 }
else if (8 *
sizeof(npy_int32) - 1 > 2 * PyLong_SHIFT) {
27109 return (npy_int32) (((npy_int32)-1)*(((((npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0])));
27114 if (8 *
sizeof(npy_int32) > 1 * PyLong_SHIFT) {
27115 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
27116 __PYX_VERIFY_RETURN_INT(npy_int32,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27117 }
else if (8 *
sizeof(npy_int32) - 1 > 2 * PyLong_SHIFT) {
27118 return (npy_int32) ((((((npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0])));
27123 if (8 *
sizeof(npy_int32) - 1 > 2 * PyLong_SHIFT) {
27124 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
27125 __PYX_VERIFY_RETURN_INT(npy_int32,
long, -(
long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27126 }
else if (8 *
sizeof(npy_int32) - 1 > 3 * PyLong_SHIFT) {
27127 return (npy_int32) (((npy_int32)-1)*(((((((npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0])));
27132 if (8 *
sizeof(npy_int32) > 2 * PyLong_SHIFT) {
27133 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
27134 __PYX_VERIFY_RETURN_INT(npy_int32,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27135 }
else if (8 *
sizeof(npy_int32) - 1 > 3 * PyLong_SHIFT) {
27136 return (npy_int32) ((((((((npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0])));
27141 if (8 *
sizeof(npy_int32) - 1 > 3 * PyLong_SHIFT) {
27142 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
27143 __PYX_VERIFY_RETURN_INT(npy_int32,
long, -(
long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27144 }
else if (8 *
sizeof(npy_int32) - 1 > 4 * PyLong_SHIFT) {
27145 return (npy_int32) (((npy_int32)-1)*(((((((((npy_int32)digits[3]) << PyLong_SHIFT) | (npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0])));
27150 if (8 *
sizeof(npy_int32) > 3 * PyLong_SHIFT) {
27151 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
27152 __PYX_VERIFY_RETURN_INT(npy_int32,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27153 }
else if (8 *
sizeof(npy_int32) - 1 > 4 * PyLong_SHIFT) {
27154 return (npy_int32) ((((((((((npy_int32)digits[3]) << PyLong_SHIFT) | (npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0])));
27160 if (
sizeof(npy_int32) <=
sizeof(long)) {
27161 __PYX_VERIFY_RETURN_INT_EXC(npy_int32,
long, PyLong_AsLong(x))
27162 #ifdef HAVE_LONG_LONG
27163 }
else if (
sizeof(npy_int32) <=
sizeof(PY_LONG_LONG)) {
27164 __PYX_VERIFY_RETURN_INT_EXC(npy_int32, PY_LONG_LONG, PyLong_AsLongLong(x))
27169 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
27170 PyErr_SetString(PyExc_RuntimeError,
27171 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
27174 PyObject *
v = __Pyx_PyNumber_IntOrLong(x);
27175 #if PY_MAJOR_VERSION < 3
27176 if (likely(
v) && !PyLong_Check(
v)) {
27178 v = PyNumber_Long(tmp);
27183 int one = 1;
int is_little = (int)*(
unsigned char *)&one;
27184 unsigned char *bytes = (
unsigned char *)&val;
27185 int ret = _PyLong_AsByteArray((PyLongObject *)
v,
27186 bytes,
sizeof(val),
27187 is_little, !is_unsigned);
27193 return (npy_int32) -1;
27197 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
27198 if (!tmp)
return (npy_int32) -1;
27199 val = __Pyx_PyInt_As_npy_int32(tmp);
27204 PyErr_SetString(PyExc_OverflowError,
27205 "value too large to convert to npy_int32");
27206 return (npy_int32) -1;
27207 raise_neg_overflow:
27208 PyErr_SetString(PyExc_OverflowError,
27209 "can't convert negative value to npy_int32");
27210 return (npy_int32) -1;
27214 static CYTHON_INLINE
size_t __Pyx_PyInt_As_size_t(PyObject *x) {
27215 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27216 #pragma GCC diagnostic push
27217 #pragma GCC diagnostic ignored "-Wconversion"
27219 const size_t neg_one = (size_t) -1, const_zero = (
size_t) 0;
27220 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27221 #pragma GCC diagnostic pop
27223 const int is_unsigned = neg_one > const_zero;
27224 #if PY_MAJOR_VERSION < 3
27225 if (likely(PyInt_Check(x))) {
27226 if (
sizeof(
size_t) <
sizeof(long)) {
27227 __PYX_VERIFY_RETURN_INT(
size_t,
long, PyInt_AS_LONG(x))
27229 long val = PyInt_AS_LONG(x);
27230 if (is_unsigned && unlikely(val < 0)) {
27231 goto raise_neg_overflow;
27233 return (
size_t) val;
27237 if (likely(PyLong_Check(x))) {
27239 #if CYTHON_USE_PYLONG_INTERNALS
27240 const digit* digits = ((PyLongObject*)x)->ob_digit;
27241 switch (Py_SIZE(x)) {
27242 case 0:
return (
size_t) 0;
27243 case 1: __PYX_VERIFY_RETURN_INT(
size_t, digit, digits[0])
27245 if (8 *
sizeof(
size_t) > 1 * PyLong_SHIFT) {
27246 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
27247 __PYX_VERIFY_RETURN_INT(
size_t,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27248 }
else if (8 *
sizeof(
size_t) >= 2 * PyLong_SHIFT) {
27249 return (
size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0]));
27254 if (8 *
sizeof(
size_t) > 2 * PyLong_SHIFT) {
27255 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
27256 __PYX_VERIFY_RETURN_INT(
size_t,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27257 }
else if (8 *
sizeof(
size_t) >= 3 * PyLong_SHIFT) {
27258 return (
size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (
size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
27263 if (8 *
sizeof(
size_t) > 3 * PyLong_SHIFT) {
27264 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
27265 __PYX_VERIFY_RETURN_INT(
size_t,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27266 }
else if (8 *
sizeof(
size_t) >= 4 * PyLong_SHIFT) {
27267 return (
size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (
size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0]));
27273 #if CYTHON_COMPILING_IN_CPYTHON
27274 if (unlikely(Py_SIZE(x) < 0)) {
27275 goto raise_neg_overflow;
27279 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
27280 if (unlikely(result < 0))
27281 return (
size_t) -1;
27282 if (unlikely(result == 1))
27283 goto raise_neg_overflow;
27286 if (
sizeof(
size_t) <=
sizeof(
unsigned long)) {
27287 __PYX_VERIFY_RETURN_INT_EXC(
size_t,
unsigned long, PyLong_AsUnsignedLong(x))
27288 #ifdef HAVE_LONG_LONG
27289 }
else if (
sizeof(
size_t) <=
sizeof(
unsigned PY_LONG_LONG)) {
27290 __PYX_VERIFY_RETURN_INT_EXC(
size_t,
unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
27294 #if CYTHON_USE_PYLONG_INTERNALS
27295 const digit* digits = ((PyLongObject*)x)->ob_digit;
27296 switch (Py_SIZE(x)) {
27297 case 0:
return (
size_t) 0;
27298 case -1: __PYX_VERIFY_RETURN_INT(
size_t, sdigit, (sdigit) (-(sdigit)digits[0]))
27299 case 1: __PYX_VERIFY_RETURN_INT(
size_t, digit, +digits[0])
27301 if (8 *
sizeof(
size_t) - 1 > 1 * PyLong_SHIFT) {
27302 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
27303 __PYX_VERIFY_RETURN_INT(
size_t,
long, -(
long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27304 }
else if (8 *
sizeof(
size_t) - 1 > 2 * PyLong_SHIFT) {
27305 return (
size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0])));
27310 if (8 *
sizeof(
size_t) > 1 * PyLong_SHIFT) {
27311 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
27312 __PYX_VERIFY_RETURN_INT(
size_t,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27313 }
else if (8 *
sizeof(
size_t) - 1 > 2 * PyLong_SHIFT) {
27314 return (
size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0])));
27319 if (8 *
sizeof(
size_t) - 1 > 2 * PyLong_SHIFT) {
27320 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
27321 __PYX_VERIFY_RETURN_INT(
size_t,
long, -(
long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27322 }
else if (8 *
sizeof(
size_t) - 1 > 3 * PyLong_SHIFT) {
27323 return (
size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (
size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
27328 if (8 *
sizeof(
size_t) > 2 * PyLong_SHIFT) {
27329 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
27330 __PYX_VERIFY_RETURN_INT(
size_t,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27331 }
else if (8 *
sizeof(
size_t) - 1 > 3 * PyLong_SHIFT) {
27332 return (
size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (
size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
27337 if (8 *
sizeof(
size_t) - 1 > 3 * PyLong_SHIFT) {
27338 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
27339 __PYX_VERIFY_RETURN_INT(
size_t,
long, -(
long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27340 }
else if (8 *
sizeof(
size_t) - 1 > 4 * PyLong_SHIFT) {
27341 return (
size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (
size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0])));
27346 if (8 *
sizeof(
size_t) > 3 * PyLong_SHIFT) {
27347 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
27348 __PYX_VERIFY_RETURN_INT(
size_t,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27349 }
else if (8 *
sizeof(
size_t) - 1 > 4 * PyLong_SHIFT) {
27350 return (
size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (
size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0])));
27356 if (
sizeof(
size_t) <=
sizeof(long)) {
27357 __PYX_VERIFY_RETURN_INT_EXC(
size_t,
long, PyLong_AsLong(x))
27358 #ifdef HAVE_LONG_LONG
27359 }
else if (
sizeof(
size_t) <=
sizeof(PY_LONG_LONG)) {
27360 __PYX_VERIFY_RETURN_INT_EXC(
size_t, PY_LONG_LONG, PyLong_AsLongLong(x))
27365 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
27366 PyErr_SetString(PyExc_RuntimeError,
27367 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
27370 PyObject *
v = __Pyx_PyNumber_IntOrLong(x);
27371 #if PY_MAJOR_VERSION < 3
27372 if (likely(
v) && !PyLong_Check(
v)) {
27374 v = PyNumber_Long(tmp);
27379 int one = 1;
int is_little = (int)*(
unsigned char *)&one;
27380 unsigned char *bytes = (
unsigned char *)&val;
27381 int ret = _PyLong_AsByteArray((PyLongObject *)
v,
27382 bytes,
sizeof(val),
27383 is_little, !is_unsigned);
27389 return (
size_t) -1;
27393 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
27394 if (!tmp)
return (
size_t) -1;
27395 val = __Pyx_PyInt_As_size_t(tmp);
27400 PyErr_SetString(PyExc_OverflowError,
27401 "value too large to convert to size_t");
27402 return (
size_t) -1;
27403 raise_neg_overflow:
27404 PyErr_SetString(PyExc_OverflowError,
27405 "can't convert negative value to size_t");
27406 return (
size_t) -1;
27410 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(
int value) {
27411 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27412 #pragma GCC diagnostic push
27413 #pragma GCC diagnostic ignored "-Wconversion"
27415 const int neg_one = (int) -1, const_zero = (
int) 0;
27416 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27417 #pragma GCC diagnostic pop
27419 const int is_unsigned = neg_one > const_zero;
27421 if (
sizeof(
int) <
sizeof(long)) {
27422 return PyInt_FromLong((
long) value);
27423 }
else if (
sizeof(
int) <=
sizeof(
unsigned long)) {
27424 return PyLong_FromUnsignedLong((
unsigned long) value);
27425 #ifdef HAVE_LONG_LONG
27426 }
else if (
sizeof(
int) <=
sizeof(
unsigned PY_LONG_LONG)) {
27427 return PyLong_FromUnsignedLongLong((
unsigned PY_LONG_LONG) value);
27431 if (
sizeof(
int) <=
sizeof(
long)) {
27432 return PyInt_FromLong((
long) value);
27433 #ifdef HAVE_LONG_LONG
27434 }
else if (
sizeof(
int) <=
sizeof(PY_LONG_LONG)) {
27435 return PyLong_FromLongLong((PY_LONG_LONG) value);
27440 int one = 1;
int little = (int)*(
unsigned char *)&one;
27441 unsigned char *bytes = (
unsigned char *)&value;
27442 return _PyLong_FromByteArray(bytes,
sizeof(
int),
27443 little, !is_unsigned);
27448 static CYTHON_INLINE
long __Pyx_PyInt_As_long(PyObject *x) {
27449 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27450 #pragma GCC diagnostic push
27451 #pragma GCC diagnostic ignored "-Wconversion"
27453 const long neg_one = (long) -1, const_zero = (
long) 0;
27454 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27455 #pragma GCC diagnostic pop
27457 const int is_unsigned = neg_one > const_zero;
27458 #if PY_MAJOR_VERSION < 3
27459 if (likely(PyInt_Check(x))) {
27460 if (
sizeof(
long) <
sizeof(long)) {
27461 __PYX_VERIFY_RETURN_INT(
long,
long, PyInt_AS_LONG(x))
27463 long val = PyInt_AS_LONG(x);
27464 if (is_unsigned && unlikely(val < 0)) {
27465 goto raise_neg_overflow;
27471 if (likely(PyLong_Check(x))) {
27473 #if CYTHON_USE_PYLONG_INTERNALS
27474 const digit* digits = ((PyLongObject*)x)->ob_digit;
27475 switch (Py_SIZE(x)) {
27476 case 0:
return (
long) 0;
27477 case 1: __PYX_VERIFY_RETURN_INT(
long, digit, digits[0])
27479 if (8 *
sizeof(
long) > 1 * PyLong_SHIFT) {
27480 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
27481 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27482 }
else if (8 *
sizeof(
long) >= 2 * PyLong_SHIFT) {
27483 return (
long) (((((long)digits[1]) << PyLong_SHIFT) | (
long)digits[0]));
27488 if (8 *
sizeof(
long) > 2 * PyLong_SHIFT) {
27489 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
27490 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27491 }
else if (8 *
sizeof(
long) >= 3 * PyLong_SHIFT) {
27492 return (
long) (((((((long)digits[2]) << PyLong_SHIFT) | (
long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
27497 if (8 *
sizeof(
long) > 3 * PyLong_SHIFT) {
27498 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
27499 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27500 }
else if (8 *
sizeof(
long) >= 4 * PyLong_SHIFT) {
27501 return (
long) (((((((((long)digits[3]) << PyLong_SHIFT) | (
long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (
long)digits[0]));
27507 #if CYTHON_COMPILING_IN_CPYTHON
27508 if (unlikely(Py_SIZE(x) < 0)) {
27509 goto raise_neg_overflow;
27513 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
27514 if (unlikely(result < 0))
27516 if (unlikely(result == 1))
27517 goto raise_neg_overflow;
27520 if (
sizeof(
long) <=
sizeof(
unsigned long)) {
27521 __PYX_VERIFY_RETURN_INT_EXC(
long,
unsigned long, PyLong_AsUnsignedLong(x))
27522 #ifdef HAVE_LONG_LONG
27523 }
else if (
sizeof(
long) <=
sizeof(
unsigned PY_LONG_LONG)) {
27524 __PYX_VERIFY_RETURN_INT_EXC(
long,
unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
27528 #if CYTHON_USE_PYLONG_INTERNALS
27529 const digit* digits = ((PyLongObject*)x)->ob_digit;
27530 switch (Py_SIZE(x)) {
27531 case 0:
return (
long) 0;
27532 case -1: __PYX_VERIFY_RETURN_INT(
long, sdigit, (sdigit) (-(sdigit)digits[0]))
27533 case 1: __PYX_VERIFY_RETURN_INT(
long, digit, +digits[0])
27535 if (8 *
sizeof(
long) - 1 > 1 * PyLong_SHIFT) {
27536 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
27537 __PYX_VERIFY_RETURN_INT(
long,
long, -(
long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27538 }
else if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
27539 return (
long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
27544 if (8 *
sizeof(
long) > 1 * PyLong_SHIFT) {
27545 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
27546 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27547 }
else if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
27548 return (
long) ((((((long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
27553 if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
27554 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
27555 __PYX_VERIFY_RETURN_INT(
long,
long, -(
long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27556 }
else if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
27557 return (
long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (
long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
27562 if (8 *
sizeof(
long) > 2 * PyLong_SHIFT) {
27563 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
27564 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27565 }
else if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
27566 return (
long) ((((((((long)digits[2]) << PyLong_SHIFT) | (
long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
27571 if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
27572 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
27573 __PYX_VERIFY_RETURN_INT(
long,
long, -(
long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27574 }
else if (8 *
sizeof(
long) - 1 > 4 * PyLong_SHIFT) {
27575 return (
long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (
long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
27580 if (8 *
sizeof(
long) > 3 * PyLong_SHIFT) {
27581 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
27582 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27583 }
else if (8 *
sizeof(
long) - 1 > 4 * PyLong_SHIFT) {
27584 return (
long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (
long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
27590 if (
sizeof(
long) <=
sizeof(long)) {
27591 __PYX_VERIFY_RETURN_INT_EXC(
long,
long, PyLong_AsLong(x))
27592 #ifdef HAVE_LONG_LONG
27593 }
else if (
sizeof(
long) <=
sizeof(PY_LONG_LONG)) {
27594 __PYX_VERIFY_RETURN_INT_EXC(
long, PY_LONG_LONG, PyLong_AsLongLong(x))
27599 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
27600 PyErr_SetString(PyExc_RuntimeError,
27601 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
27604 PyObject *
v = __Pyx_PyNumber_IntOrLong(x);
27605 #if PY_MAJOR_VERSION < 3
27606 if (likely(
v) && !PyLong_Check(
v)) {
27608 v = PyNumber_Long(tmp);
27613 int one = 1;
int is_little = (int)*(
unsigned char *)&one;
27614 unsigned char *bytes = (
unsigned char *)&val;
27615 int ret = _PyLong_AsByteArray((PyLongObject *)
v,
27616 bytes,
sizeof(val),
27617 is_little, !is_unsigned);
27627 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
27628 if (!tmp)
return (
long) -1;
27629 val = __Pyx_PyInt_As_long(tmp);
27634 PyErr_SetString(PyExc_OverflowError,
27635 "value too large to convert to long");
27637 raise_neg_overflow:
27638 PyErr_SetString(PyExc_OverflowError,
27639 "can't convert negative value to long");
27644 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(
long value) {
27645 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27646 #pragma GCC diagnostic push
27647 #pragma GCC diagnostic ignored "-Wconversion"
27649 const long neg_one = (long) -1, const_zero = (
long) 0;
27650 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27651 #pragma GCC diagnostic pop
27653 const int is_unsigned = neg_one > const_zero;
27655 if (
sizeof(
long) <
sizeof(long)) {
27656 return PyInt_FromLong((
long) value);
27657 }
else if (
sizeof(
long) <=
sizeof(
unsigned long)) {
27658 return PyLong_FromUnsignedLong((
unsigned long) value);
27659 #ifdef HAVE_LONG_LONG
27660 }
else if (
sizeof(
long) <=
sizeof(
unsigned PY_LONG_LONG)) {
27661 return PyLong_FromUnsignedLongLong((
unsigned PY_LONG_LONG) value);
27665 if (
sizeof(
long) <=
sizeof(
long)) {
27666 return PyInt_FromLong((
long) value);
27667 #ifdef HAVE_LONG_LONG
27668 }
else if (
sizeof(
long) <=
sizeof(PY_LONG_LONG)) {
27669 return PyLong_FromLongLong((PY_LONG_LONG) value);
27674 int one = 1;
int little = (int)*(
unsigned char *)&one;
27675 unsigned char *bytes = (
unsigned char *)&value;
27676 return _PyLong_FromByteArray(bytes,
sizeof(
long),
27677 little, !is_unsigned);
27682 static CYTHON_INLINE
char __Pyx_PyInt_As_char(PyObject *x) {
27683 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27684 #pragma GCC diagnostic push
27685 #pragma GCC diagnostic ignored "-Wconversion"
27687 const char neg_one = (char) -1, const_zero = (
char) 0;
27688 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27689 #pragma GCC diagnostic pop
27691 const int is_unsigned = neg_one > const_zero;
27692 #if PY_MAJOR_VERSION < 3
27693 if (likely(PyInt_Check(x))) {
27694 if (
sizeof(
char) <
sizeof(long)) {
27695 __PYX_VERIFY_RETURN_INT(
char,
long, PyInt_AS_LONG(x))
27697 long val = PyInt_AS_LONG(x);
27698 if (is_unsigned && unlikely(val < 0)) {
27699 goto raise_neg_overflow;
27705 if (likely(PyLong_Check(x))) {
27707 #if CYTHON_USE_PYLONG_INTERNALS
27708 const digit* digits = ((PyLongObject*)x)->ob_digit;
27709 switch (Py_SIZE(x)) {
27710 case 0:
return (
char) 0;
27711 case 1: __PYX_VERIFY_RETURN_INT(
char, digit, digits[0])
27713 if (8 *
sizeof(
char) > 1 * PyLong_SHIFT) {
27714 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
27715 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27716 }
else if (8 *
sizeof(
char) >= 2 * PyLong_SHIFT) {
27717 return (
char) (((((char)digits[1]) << PyLong_SHIFT) | (
char)digits[0]));
27722 if (8 *
sizeof(
char) > 2 * PyLong_SHIFT) {
27723 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
27724 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27725 }
else if (8 *
sizeof(
char) >= 3 * PyLong_SHIFT) {
27726 return (
char) (((((((char)digits[2]) << PyLong_SHIFT) | (
char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
27731 if (8 *
sizeof(
char) > 3 * PyLong_SHIFT) {
27732 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
27733 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27734 }
else if (8 *
sizeof(
char) >= 4 * PyLong_SHIFT) {
27735 return (
char) (((((((((char)digits[3]) << PyLong_SHIFT) | (
char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (
char)digits[0]));
27741 #if CYTHON_COMPILING_IN_CPYTHON
27742 if (unlikely(Py_SIZE(x) < 0)) {
27743 goto raise_neg_overflow;
27747 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
27748 if (unlikely(result < 0))
27750 if (unlikely(result == 1))
27751 goto raise_neg_overflow;
27754 if (
sizeof(
char) <=
sizeof(
unsigned long)) {
27755 __PYX_VERIFY_RETURN_INT_EXC(
char,
unsigned long, PyLong_AsUnsignedLong(x))
27756 #ifdef HAVE_LONG_LONG
27757 }
else if (
sizeof(
char) <=
sizeof(
unsigned PY_LONG_LONG)) {
27758 __PYX_VERIFY_RETURN_INT_EXC(
char,
unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
27762 #if CYTHON_USE_PYLONG_INTERNALS
27763 const digit* digits = ((PyLongObject*)x)->ob_digit;
27764 switch (Py_SIZE(x)) {
27765 case 0:
return (
char) 0;
27766 case -1: __PYX_VERIFY_RETURN_INT(
char, sdigit, (sdigit) (-(sdigit)digits[0]))
27767 case 1: __PYX_VERIFY_RETURN_INT(
char, digit, +digits[0])
27769 if (8 *
sizeof(
char) - 1 > 1 * PyLong_SHIFT) {
27770 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
27771 __PYX_VERIFY_RETURN_INT(
char,
long, -(
long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27772 }
else if (8 *
sizeof(
char) - 1 > 2 * PyLong_SHIFT) {
27773 return (
char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (
char)digits[0])));
27778 if (8 *
sizeof(
char) > 1 * PyLong_SHIFT) {
27779 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
27780 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27781 }
else if (8 *
sizeof(
char) - 1 > 2 * PyLong_SHIFT) {
27782 return (
char) ((((((char)digits[1]) << PyLong_SHIFT) | (
char)digits[0])));
27787 if (8 *
sizeof(
char) - 1 > 2 * PyLong_SHIFT) {
27788 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
27789 __PYX_VERIFY_RETURN_INT(
char,
long, -(
long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27790 }
else if (8 *
sizeof(
char) - 1 > 3 * PyLong_SHIFT) {
27791 return (
char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (
char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
27796 if (8 *
sizeof(
char) > 2 * PyLong_SHIFT) {
27797 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
27798 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27799 }
else if (8 *
sizeof(
char) - 1 > 3 * PyLong_SHIFT) {
27800 return (
char) ((((((((char)digits[2]) << PyLong_SHIFT) | (
char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
27805 if (8 *
sizeof(
char) - 1 > 3 * PyLong_SHIFT) {
27806 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
27807 __PYX_VERIFY_RETURN_INT(
char,
long, -(
long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27808 }
else if (8 *
sizeof(
char) - 1 > 4 * PyLong_SHIFT) {
27809 return (
char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (
char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (
char)digits[0])));
27814 if (8 *
sizeof(
char) > 3 * PyLong_SHIFT) {
27815 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
27816 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27817 }
else if (8 *
sizeof(
char) - 1 > 4 * PyLong_SHIFT) {
27818 return (
char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (
char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (
char)digits[0])));
27824 if (
sizeof(
char) <=
sizeof(long)) {
27825 __PYX_VERIFY_RETURN_INT_EXC(
char,
long, PyLong_AsLong(x))
27826 #ifdef HAVE_LONG_LONG
27827 }
else if (
sizeof(
char) <=
sizeof(PY_LONG_LONG)) {
27828 __PYX_VERIFY_RETURN_INT_EXC(
char, PY_LONG_LONG, PyLong_AsLongLong(x))
27833 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
27834 PyErr_SetString(PyExc_RuntimeError,
27835 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
27838 PyObject *
v = __Pyx_PyNumber_IntOrLong(x);
27839 #if PY_MAJOR_VERSION < 3
27840 if (likely(
v) && !PyLong_Check(
v)) {
27842 v = PyNumber_Long(tmp);
27847 int one = 1;
int is_little = (int)*(
unsigned char *)&one;
27848 unsigned char *bytes = (
unsigned char *)&val;
27849 int ret = _PyLong_AsByteArray((PyLongObject *)
v,
27850 bytes,
sizeof(val),
27851 is_little, !is_unsigned);
27861 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
27862 if (!tmp)
return (
char) -1;
27863 val = __Pyx_PyInt_As_char(tmp);
27868 PyErr_SetString(PyExc_OverflowError,
27869 "value too large to convert to char");
27871 raise_neg_overflow:
27872 PyErr_SetString(PyExc_OverflowError,
27873 "can't convert negative value to char");
27878 static int __Pyx_check_binary_version(
void) {
27879 char ctversion[4], rtversion[4];
27880 PyOS_snprintf(ctversion, 4,
"%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
27881 PyOS_snprintf(rtversion, 4,
"%s", Py_GetVersion());
27882 if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
27884 PyOS_snprintf(message,
sizeof(message),
27885 "compiletime version %s of module '%.100s' "
27886 "does not match runtime version %s",
27887 ctversion, __Pyx_MODULE_NAME, rtversion);
27888 return PyErr_WarnEx(NULL, message, 1);
27894 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
27896 #if PY_MAJOR_VERSION < 3
27897 if (t->is_unicode) {
27898 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
27899 }
else if (t->intern) {
27900 *t->p = PyString_InternFromString(t->s);
27902 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
27905 if (t->is_unicode | t->is_str) {
27907 *t->p = PyUnicode_InternFromString(t->s);
27908 }
else if (t->encoding) {
27909 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
27911 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
27914 *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
27919 if (PyObject_Hash(*t->p) == -1)
27926 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(
const char* c_str) {
27927 return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
27929 static CYTHON_INLINE
const char* __Pyx_PyObject_AsString(PyObject* o) {
27931 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
27933 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
27934 #if !CYTHON_PEP393_ENABLED
27935 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
27937 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
27938 if (!defenc)
return NULL;
27939 defenc_c = PyBytes_AS_STRING(defenc);
27940 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
27942 char* end = defenc_c + PyBytes_GET_SIZE(defenc);
27944 for (
c = defenc_c;
c < end;
c++) {
27945 if ((
unsigned char) (*
c) >= 128) {
27946 PyUnicode_AsASCIIString(o);
27952 *length = PyBytes_GET_SIZE(defenc);
27956 static CYTHON_INLINE
const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
27957 if (unlikely(__Pyx_PyUnicode_READY(o) == -1))
return NULL;
27958 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
27959 if (likely(PyUnicode_IS_ASCII(o))) {
27960 *length = PyUnicode_GET_LENGTH(o);
27961 return PyUnicode_AsUTF8(o);
27963 PyUnicode_AsASCIIString(o);
27967 return PyUnicode_AsUTF8AndSize(o, length);
27972 static CYTHON_INLINE
const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
27973 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
27975 #
if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
27976 __Pyx_sys_getdefaultencoding_not_ascii &&
27978 PyUnicode_Check(o)) {
27979 return __Pyx_PyUnicode_AsStringAndSize(o, length);
27982 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
27983 if (PyByteArray_Check(o)) {
27984 *length = PyByteArray_GET_SIZE(o);
27985 return PyByteArray_AS_STRING(o);
27990 int r = PyBytes_AsStringAndSize(o, &result, length);
27991 if (unlikely(
r < 0)) {
27998 static CYTHON_INLINE
int __Pyx_PyObject_IsTrue(PyObject* x) {
27999 int is_true = x == Py_True;
28000 if (is_true | (x == Py_False) | (x == Py_None))
return is_true;
28001 else return PyObject_IsTrue(x);
28003 static CYTHON_INLINE
int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
28005 if (unlikely(!x))
return -1;
28006 retval = __Pyx_PyObject_IsTrue(x);
28010 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result,
const char* type_name) {
28011 #if PY_MAJOR_VERSION >= 3
28012 if (PyLong_Check(result)) {
28013 if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
28014 "__int__ returned non-int (type %.200s). "
28015 "The ability to return an instance of a strict subclass of int "
28016 "is deprecated, and may be removed in a future version of Python.",
28017 Py_TYPE(result)->tp_name)) {
28024 PyErr_Format(PyExc_TypeError,
28025 "__%.4s__ returned non-%.4s (type %.200s)",
28026 type_name, type_name, Py_TYPE(result)->tp_name);
28030 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
28031 #if CYTHON_USE_TYPE_SLOTS
28032 PyNumberMethods *m;
28034 const char *name = NULL;
28035 PyObject *res = NULL;
28036 #if PY_MAJOR_VERSION < 3
28037 if (likely(PyInt_Check(x) || PyLong_Check(x)))
28039 if (likely(PyLong_Check(x)))
28041 return __Pyx_NewRef(x);
28042 #if CYTHON_USE_TYPE_SLOTS
28043 m = Py_TYPE(x)->tp_as_number;
28044 #if PY_MAJOR_VERSION < 3
28045 if (m && m->nb_int) {
28047 res = m->nb_int(x);
28049 else if (m && m->nb_long) {
28051 res = m->nb_long(x);
28054 if (likely(m && m->nb_int)) {
28056 res = m->nb_int(x);
28060 if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
28061 res = PyNumber_Int(x);
28065 #if PY_MAJOR_VERSION < 3
28066 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
28068 if (unlikely(!PyLong_CheckExact(res))) {
28070 return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
28073 else if (!PyErr_Occurred()) {
28074 PyErr_SetString(PyExc_TypeError,
28075 "an integer is required");
28079 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
28082 #if PY_MAJOR_VERSION < 3
28083 if (likely(PyInt_CheckExact(b))) {
28084 if (
sizeof(Py_ssize_t) >=
sizeof(
long))
28085 return PyInt_AS_LONG(b);
28087 return PyInt_AsSsize_t(b);
28090 if (likely(PyLong_CheckExact(b))) {
28091 #if CYTHON_USE_PYLONG_INTERNALS
28092 const digit* digits = ((PyLongObject*)b)->ob_digit;
28093 const Py_ssize_t size = Py_SIZE(b);
28094 if (likely(__Pyx_sst_abs(size) <= 1)) {
28095 ival = likely(size) ? digits[0] : 0;
28096 if (size == -1) ival = -ival;
28101 if (8 *
sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
28102 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0]));
28106 if (8 *
sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
28107 return -(Py_ssize_t) (((((
size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
28111 if (8 *
sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
28112 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (
size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
28116 if (8 *
sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
28117 return -(Py_ssize_t) (((((((
size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0]));
28121 if (8 *
sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
28122 return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (
size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0]));
28126 if (8 *
sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
28127 return -(Py_ssize_t) (((((((((
size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (
size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
28133 return PyLong_AsSsize_t(b);
28135 x = PyNumber_Index(b);
28137 ival = PyInt_AsSsize_t(x);
28141 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(
long b) {
28142 return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
28144 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(
size_t ival) {
28145 return PyInt_FromSize_t(ival);